< prev index next >

src/hotspot/share/opto/mulnode.cpp

Print this page
rev 52430 : 8213473: Prevent transformation of LoadB->AndI->CmpI pattern to facilitate testb instruction matching

@@ -488,11 +488,14 @@
       return new AndINode(ldus, phase->intcon(mask & 0xFFFF));
     }
 
     // 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));
     }
   }
< prev index next >