changeset 7936:64bd5b63923c

8154831: CastII/ConvI2L for a range check is prematurely eliminated Reviewed-by: kvn, thartmann
author vlivanov
date Tue, 24 May 2016 18:42:01 +0300
parents 776cb7cbe2e4
children 619e7d418a44
files src/share/vm/opto/connode.cpp src/share/vm/opto/subnode.cpp
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/connode.cpp	Mon Apr 25 11:36:14 2016 +0200
+++ b/src/share/vm/opto/connode.cpp	Tue May 24 18:42:01 2016 +0300
@@ -446,7 +446,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) {
@@ -523,7 +525,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);
--- a/src/share/vm/opto/subnode.cpp	Mon Apr 25 11:36:14 2016 +0200
+++ b/src/share/vm/opto/subnode.cpp	Tue May 24 18:42:01 2016 +0300
@@ -547,8 +547,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.