diff src/share/vm/opto/cfgnode.cpp @ 127:e0bd2e08e3d0

6663848: assert(i < Max(),"oob") in C2 with -Xcomp Summary: NeverBranchNodes aren't handled properly Reviewed-by: kvn, sgoldman, rasbold, jrose
author never
date Thu, 24 Apr 2008 11:13:03 -0700
parents 72f4a668df19
children 885ed790ecf0
line wrap: on
line diff
--- a/src/share/vm/opto/cfgnode.cpp	Wed Apr 23 19:09:16 2008 -0700
+++ b/src/share/vm/opto/cfgnode.cpp	Thu Apr 24 11:13:03 2008 -0700
@@ -2019,6 +2019,28 @@
 }
 
 //=============================================================================
+//------------------------------Value------------------------------------------
+// Check for being unreachable.
+const Type *NeverBranchNode::Value( PhaseTransform *phase ) const {
+  if (!in(0) || in(0)->is_top()) return Type::TOP;
+  return bottom_type();
+}
+
+//------------------------------Ideal------------------------------------------
+// Check for no longer being part of a loop
+Node *NeverBranchNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  if (can_reshape && !in(0)->is_Loop()) {
+    // Dead code elimination can sometimes delete this projection so
+    // if it's not there, there's nothing to do.
+    Node* fallthru = proj_out(0);
+    if (fallthru != NULL) {
+      phase->is_IterGVN()->subsume_node(fallthru, in(0));
+    }
+    return phase->C->top();
+  }
+  return NULL;
+}
+
 #ifndef PRODUCT
 void NeverBranchNode::format( PhaseRegAlloc *ra_, outputStream *st) const {
   st->print("%s", Name());