# HG changeset patch # User vlivanov # Date 1464104521 -10800 # Node ID 79dd5370ad0fee8754546283326d972367bce5d6 # Parent aa627f367a9a51542821dd4a20c372b23166f284 8154831: CastII/ConvI2L for a range check is prematurely eliminated Reviewed-by: kvn, thartmann diff -r aa627f367a9a -r 79dd5370ad0f src/share/vm/opto/connode.cpp --- a/src/share/vm/opto/connode.cpp Wed Feb 05 04:12:59 2020 +0000 +++ b/src/share/vm/opto/connode.cpp Tue May 24 18:42:01 2016 +0300 @@ -444,7 +444,9 @@ } uint CastIINode::cmp(const Node &n) const { - return TypeNode::cmp(n) && ((CastIINode&)n)._carry_dependency == _carry_dependency; + return TypeNode::cmp(n) && + ((CastIINode&)n)._carry_dependency == _carry_dependency && + ((CastIINode&)n)._range_check_dependency == _range_check_dependency; } Node *CastIINode::Identity(PhaseTransform *phase) { @@ -521,7 +523,7 @@ } Node *CastIINode::Ideal_DU_postCCP(PhaseCCP *ccp) { - if (_carry_dependency) { + if (_carry_dependency || _range_check_dependency) { return NULL; } return ConstraintCastNode::Ideal_DU_postCCP(ccp); diff -r aa627f367a9a -r 79dd5370ad0f src/share/vm/opto/subnode.cpp --- a/src/share/vm/opto/subnode.cpp Wed Feb 05 04:12:59 2020 +0000 +++ b/src/share/vm/opto/subnode.cpp Tue May 24 18:42:01 2016 +0300 @@ -537,8 +537,12 @@ // All unsigned values are LE -1 and GE 0. if (lo0 == 0 && hi0 == 0) { return TypeInt::CC_LE; // 0 <= bot + } else if ((jint)lo0 == -1 && (jint)hi0 == -1) { + return TypeInt::CC_GE; // -1 >= bot } else if (lo1 == 0 && hi1 == 0) { return TypeInt::CC_GE; // bot >= 0 + } else if ((jint)lo1 == -1 && (jint)hi1 == -1) { + return TypeInt::CC_LE; // bot <= -1 } } else { // We can use ranges of the form [lo..hi] if signs are the same.