< prev index next >

src/share/vm/opto/ifnode.cpp

Print this page

        

@@ -1623,10 +1623,21 @@
   }
   // no progress
   return this;
 }
 
+Node* IfProjNode::Ideal(PhaseGVN* phase, bool can_reshape) {
+  const Type* t = phase->type(in(0));
+  if (in(0)->outcnt() == 2 && t != Type::TOP && always_taken(t->is_tuple())) {
+    // cut off dead branch if this branch is always taken
+    Node* other = in(0)->as_If()->proj_out(!is_IfTrue());
+    other->set_req(0, phase->C->top());
+    return this;
+  }
+  return NULL;
+}
+
 #ifndef PRODUCT
 //-------------------------------related---------------------------------------
 // An IfProjNode's related node set consists of its input (an IfNode) including
 // the IfNode's condition, plus all of its outputs at level 1. In compact mode,
 // the restrictions for IfNode apply (see IfNode::rel).
< prev index next >