8159715: Fix for 8072422 is incorrect
authorthartmann
Mon, 20 Jun 2016 09:32:44 +0200
changeset 39429 2c9cde29cd3f
parent 39428 24cb2cb4ae0b
child 39430 ab7acda033f4
8159715: Fix for 8072422 is incorrect Summary: Fixed several issues introduced by 8072422. Reviewed-by: zmajo, kvn
hotspot/src/share/vm/opto/loopTransform.cpp
hotspot/src/share/vm/opto/loopnode.cpp
hotspot/src/share/vm/opto/loopnode.hpp
hotspot/src/share/vm/opto/parse1.cpp
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Jun 16 01:43:11 2016 +0300
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Mon Jun 20 09:32:44 2016 +0200
@@ -868,7 +868,7 @@
       Node *bol = iff->in(1);
       if (bol->req() != 2) continue; // dead constant test
       if (!bol->is_Bool()) {
-        assert(UseLoopPredicate && bol->Opcode() == Op_Conv2B, "predicate check only");
+        assert(bol->Opcode() == Op_Conv2B, "predicate check only");
         continue;
       }
       if (bol->as_Bool()->_test._test == BoolTest::ne)
@@ -1760,14 +1760,6 @@
   }
 }
 
-//------------------------------dominates_backedge---------------------------------
-// Returns true if ctrl is executed on every complete iteration
-bool IdealLoopTree::dominates_backedge(Node* ctrl) {
-  assert(ctrl->is_CFG(), "must be control");
-  Node* backedge = _head->as_Loop()->in(LoopNode::LoopBackControl);
-  return _phase->dom_lca_internal(ctrl, backedge) == ctrl;
-}
-
 //------------------------------adjust_limit-----------------------------------
 // Helper function for add_constraint().
 Node* PhaseIdealLoop::adjust_limit(int stride_con, Node * scale, Node *offset, Node *rc_limit, Node *loop_limit, Node *pre_ctrl) {
@@ -2187,10 +2179,8 @@
         if( b_test._test == BoolTest::lt ) { // Range checks always use lt
           // The underflow and overflow limits: 0 <= scale*I+offset < limit
           add_constraint( stride_con, scale_con, offset, zero, limit, pre_ctrl, &pre_limit, &main_limit );
-          if (!conditional_rc) {
-            // (0-offset)/scale could be outside of loop iterations range.
-            conditional_rc = !loop->dominates_backedge(iff);
-          }
+          // (0-offset)/scale could be outside of loop iterations range.
+          conditional_rc = true;
         } else {
           if (PrintOpto) {
             tty->print_cr("missed RCE opportunity");
@@ -2221,12 +2211,10 @@
           // Note: (MIN_INT+1 == -MAX_INT) is used instead of MIN_INT here
           // to avoid problem with scale == -1: MIN_INT/(-1) == MIN_INT.
           add_constraint( stride_con, scale_con, offset, mini, limit, pre_ctrl, &pre_limit, &main_limit );
-          if (!conditional_rc) {
-            // ((MIN_INT+1)-offset)/scale could be outside of loop iterations range.
-            // Note: negative offset is replaced with 0 but (MIN_INT+1)/scale could
-            // still be outside of loop range.
-            conditional_rc = !loop->dominates_backedge(iff);
-          }
+          // ((MIN_INT+1)-offset)/scale could be outside of loop iterations range.
+          // Note: negative offset is replaced with 0 but (MIN_INT+1)/scale could
+          // still be outside of loop range.
+          conditional_rc = true;
           break;
         default:
           if (PrintOpto) {
--- a/hotspot/src/share/vm/opto/loopnode.cpp	Thu Jun 16 01:43:11 2016 +0300
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Mon Jun 20 09:32:44 2016 +0200
@@ -2225,9 +2225,7 @@
   // Some parser-inserted loop predicates could never be used by loop
   // predication or they were moved away from loop during some optimizations.
   // For example, peeling. Eliminate them before next loop optimizations.
-  if (UseLoopPredicate) {
-    eliminate_useless_predicates();
-  }
+  eliminate_useless_predicates();
 
 #ifndef PRODUCT
   C->verify_graph_edges();
--- a/hotspot/src/share/vm/opto/loopnode.hpp	Thu Jun 16 01:43:11 2016 +0300
+++ b/hotspot/src/share/vm/opto/loopnode.hpp	Mon Jun 20 09:32:44 2016 +0200
@@ -468,9 +468,6 @@
   // Check for Node being a loop-breaking test
   Node *is_loop_exit(Node *iff) const;
 
-  // Returns true if ctrl is executed on every complete iteration
-  bool dominates_backedge(Node* ctrl);
-
   // Remove simplistic dead code from loop body
   void DCE_loop_body();
 
--- a/hotspot/src/share/vm/opto/parse1.cpp	Thu Jun 16 01:43:11 2016 +0300
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Mon Jun 20 09:32:44 2016 +0200
@@ -662,7 +662,7 @@
         // (Note that dead locals do not get phis built, ever.)
         ensure_phis_everywhere();
 
-        if (block->is_SEL_head() && UseLoopPredicate) {
+        if (block->is_SEL_head()) {
           // Add predicate to single entry (not irreducible) loop head.
           assert(!block->has_merged_backedge(), "only entry paths should be merged for now");
           // Need correct bci for predicate.