< prev index next >

src/share/vm/opto/castnode.cpp

Print this page

        

@@ -223,11 +223,14 @@
   if (progress != NULL) {
     return progress;
   }
 
   // Similar to ConvI2LNode::Ideal() for the same reasons
-  if (can_reshape && !phase->C->major_progress()) {
+  // Do not narrow the type of range check dependent CastIINodes to
+  // avoid corruption of the graph if a CastII is replaced by TOP but
+  // the corresponding range check is not removed.
+  if (can_reshape && !_range_check_dependency && !phase->C->major_progress()) {
     const TypeInt* this_type = this->type()->is_int();
     const TypeInt* in_type = phase->type(in(1))->isa_int();
     if (in_type != NULL && this_type != NULL &&
         (in_type->_lo != this_type->_lo ||
          in_type->_hi != this_type->_hi)) {
< prev index next >