hotspot/src/share/vm/opto/loopPredicate.cpp
changeset 10258 10c77b8c8d3e
parent 10253 35b975b1e8f3
child 10263 fa58671dde31
--- a/hotspot/src/share/vm/opto/loopPredicate.cpp	Thu Jul 28 13:03:39 2011 -0700
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp	Fri Jul 29 09:16:29 2011 -0700
@@ -327,81 +327,20 @@
   return new_predicate_proj;
 }
 
-//--------------------------move_predicate-----------------------
-// Cut predicate from old place and move it to new.
-ProjNode* PhaseIdealLoop::move_predicate(ProjNode* predicate_proj, Node* new_entry,
-                                         Deoptimization::DeoptReason reason,
-                                         PhaseIdealLoop* loop_phase,
-                                         PhaseIterGVN* igvn) {
-  assert(new_entry != NULL, "must be");
-  assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be");
-  IfNode* iff = predicate_proj->in(0)->as_If();
-  Node* old_entry = iff->in(0);
-
-  // Cut predicate from old place.
-  Node* old = predicate_proj;
-  igvn->_worklist.push(old);
-  for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin;) {
-    Node* use = old->last_out(i);  // for each use...
-    igvn->hash_delete(use);
-    igvn->_worklist.push(use);
-    // Update use-def info
-    uint uses_found = 0;
-    for (uint j = 0; j < use->req(); j++) {
-      if (use->in(j) == old) {
-        use->set_req(j, old_entry);
-        uses_found++;
-        if (loop_phase != NULL) {
-          if (use->is_CFG()) {
-            // When called from beautify_loops() idom is not constructed yet.
-            if (loop_phase->_idom != NULL)
-              loop_phase->set_idom(use, old_entry, loop_phase->dom_depth(use));
-          } else {
-            loop_phase->set_ctrl(use, old_entry);
-          }
-        }
-      }
-    }
-    i -= uses_found;    // we deleted 1 or more copies of this edge
-  }
-
-  // Move predicate.
-  igvn->hash_delete(iff);
-  iff->set_req(0, new_entry);
-  igvn->_worklist.push(iff);
-
-  if (loop_phase != NULL) {
-    // Fix up idom and ctrl.
-    loop_phase->set_ctrl(iff->in(1), new_entry);
-    loop_phase->set_ctrl(iff->in(1)->in(1), new_entry);
-    // When called from beautify_loops() idom is not constructed yet.
-    if (loop_phase->_idom != NULL)
-      loop_phase->set_idom(iff, new_entry, loop_phase->dom_depth(iff));
-  }
-
-  return predicate_proj;
-}
 
 //--------------------------clone_loop_predicates-----------------------
 // Interface from IGVN
 Node* PhaseIterGVN::clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) {
-  return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, false, clone_limit_check, NULL, this);
-}
-Node* PhaseIterGVN::move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) {
-  return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, true, clone_limit_check, NULL, this);
+  return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, clone_limit_check, NULL, this);
 }
 
 // Interface from PhaseIdealLoop
 Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) {
-  return clone_loop_predicates(old_entry, new_entry, false, clone_limit_check, this, &this->_igvn);
-}
-Node* PhaseIdealLoop::move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) {
-  return clone_loop_predicates(old_entry, new_entry, true, clone_limit_check, this, &this->_igvn);
+  return clone_loop_predicates(old_entry, new_entry, clone_limit_check, this, &this->_igvn);
 }
 
 // Clone loop predicates to cloned loops (peeled, unswitched, split_if).
 Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry,
-                                                bool move_predicates,
                                                 bool clone_limit_check,
                                                 PhaseIdealLoop* loop_phase,
                                                 PhaseIterGVN* igvn) {
@@ -424,20 +363,13 @@
   if (UseLoopPredicate) {
     ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
     if (predicate_proj != NULL) { // right pattern that can be used by loop predication
-      if (move_predicates) {
-        new_entry =  move_predicate(predicate_proj, new_entry,
-                                    Deoptimization::Reason_predicate,
-                                    loop_phase, igvn);
-        assert(new_entry == predicate_proj, "old predicate fall through projection");
-      } else {
-        // clone predicate
-        new_entry = clone_predicate(predicate_proj, new_entry,
-                                    Deoptimization::Reason_predicate,
-                                    loop_phase, igvn);
-        assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone predicate");
-      }
+      // clone predicate
+      new_entry = clone_predicate(predicate_proj, new_entry,
+                                  Deoptimization::Reason_predicate,
+                                  loop_phase, igvn);
+      assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone predicate");
       if (TraceLoopPredicate) {
-        tty->print_cr("Loop Predicate %s: ", move_predicates ? "moved" : "cloned");
+        tty->print("Loop Predicate cloned: ");
         debug_only( new_entry->in(0)->dump(); )
       }
     }
@@ -446,45 +378,18 @@
     // Clone loop limit check last to insert it before loop.
     // Don't clone a limit check which was already finalized
     // for this counted loop (only one limit check is needed).
-    if (move_predicates) {
-      new_entry =  move_predicate(limit_check_proj, new_entry,
-                                  Deoptimization::Reason_loop_limit_check,
-                                  loop_phase, igvn);
-      assert(new_entry == limit_check_proj, "old limit check fall through projection");
-    } else {
-      new_entry = clone_predicate(limit_check_proj, new_entry,
-                                  Deoptimization::Reason_loop_limit_check,
-                                  loop_phase, igvn);
-      assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone limit check");
-    }
+    new_entry = clone_predicate(limit_check_proj, new_entry,
+                                Deoptimization::Reason_loop_limit_check,
+                                loop_phase, igvn);
+    assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone limit check");
     if (TraceLoopLimitCheck) {
-      tty->print_cr("Loop Limit Check %s: ", move_predicates ? "moved" : "cloned");
+      tty->print("Loop Limit Check cloned: ");
       debug_only( new_entry->in(0)->dump(); )
     }
   }
   return new_entry;
 }
 
-//--------------------------eliminate_loop_predicates-----------------------
-void PhaseIdealLoop::eliminate_loop_predicates(Node* entry) {
-  if (LoopLimitCheck) {
-    Node* predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check);
-    if (predicate != NULL) {
-      entry = entry->in(0)->in(0);
-    }
-  }
-  if (UseLoopPredicate) {
-    ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
-    if (predicate_proj != NULL) { // right pattern that can be used by loop predication
-      Node* n = entry->in(0)->in(1)->in(1);
-      assert(n->Opcode()==Op_Opaque1, "must be");
-      // Remove Opaque1 node from predicates list.
-      // IGVN will remove this predicate check.
-      _igvn.replace_node(n, n->in(1));
-    }
-  }
-}
-
 //--------------------------skip_loop_predicates------------------------------
 // Skip related predicates.
 Node* PhaseIdealLoop::skip_loop_predicates(Node* entry) {