--- old/src/hotspot/share/opto/mulnode.cpp 2018-11-07 12:23:48.115336259 +0100 +++ new/src/hotspot/share/opto/mulnode.cpp 2018-11-07 12:23:47.973337054 +0100 @@ -478,15 +478,6 @@ Node *load = in(1); uint lop = load->Opcode(); -#if INCLUDE_SHENANDOAHGC - if (UseShenandoahGC && ShenandoahWriteBarrierNode::is_gc_state_load(load)) { - // Do not touch the load+mask, we would match the whole sequence exactly. - // Converting the load to LoadUB/LoadUS would mismatch and waste a register - // on the barrier fastpath. - return NULL; - } -#endif - // Masking bits off of a Character? Hi bits are already zero. if( lop == Op_LoadUS && (mask & 0xFFFF0000) ) // Can we make a smaller mask? @@ -503,7 +494,10 @@ // Masking sign bits off of a Byte? Do an unsigned byte load plus // an and. - if (lop == Op_LoadB && (mask & 0xFFFFFF00) == 0) { + // Prevent transform if it feeds to CmpI. We have special matcher + // for LoadB+AndI+CmpI that generates a single instruction. + bool feeds_to_cmpi = outcnt() == 1 && unique_out()->Opcode() == Op_CmpI; + if (lop == Op_LoadB && (mask & 0xFFFFFF00) == 0 && !feeds_to_cmpi) { Node* ldub = load->as_Load()->convert_to_unsigned_load(*phase); ldub = phase->transform(ldub); return new AndINode(ldub, phase->intcon(mask));