--- a/hotspot/src/share/vm/opto/castnode.cpp Fri Feb 12 12:18:44 2016 +0100
+++ b/hotspot/src/share/vm/opto/castnode.cpp Wed Feb 03 12:36:18 2016 +0100
@@ -37,7 +37,6 @@
Node* ConstraintCastNode::Identity(PhaseGVN* phase) {
Node* dom = dominating_cast(phase);
if (dom != NULL) {
- assert(_carry_dependency, "only for casts that carry a dependency");
return dom;
}
if (_carry_dependency) {
@@ -110,15 +109,18 @@
}
TypeNode* ConstraintCastNode::dominating_cast(PhaseTransform *phase) const {
- if (!carry_dependency()) {
- return NULL;
- }
Node* val = in(1);
Node* ctl = in(0);
int opc = Opcode();
if (ctl == NULL) {
return NULL;
}
+ // Range check CastIIs may all end up under a single range check and
+ // in that case only the narrower CastII would be kept by the code
+ // below which would be incorrect.
+ if (is_CastII() && as_CastII()->has_range_check()) {
+ return NULL;
+ }
for (DUIterator_Fast imax, i = val->fast_outs(imax); i < imax; i++) {
Node* u = val->fast_out(i);
if (u != this &&
@@ -300,7 +302,6 @@
Node* CheckCastPPNode::Identity(PhaseGVN* phase) {
Node* dom = dominating_cast(phase);
if (dom != NULL) {
- assert(_carry_dependency, "only for casts that carry a dependency");
return dom;
}
if (_carry_dependency) {