[llvm-commits] [llvm] r102946 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Dan Gohman gohman at apple.com
Mon May 3 13:23:48 PDT 2010


Author: djg
Date: Mon May  3 15:23:47 2010
New Revision: 102946

URL: http://llvm.org/viewvc/llvm-project?rev=102946&view=rev
Log:
Silence warnings about -1 being converted to an unsigned value.

Also, pass true for isSigned even when creating constants for unsigned
comparisons, because the point is to create an all-ones constant,
rather than UINT64_MAX, even for integers wider than 64 bits.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=102946&r1=102945&r2=102946&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon May  3 15:23:47 2010
@@ -4952,7 +4952,7 @@
       Pred = ICmpInst::ICMP_SLT;
       Changed = true;
     } else if (!getSignedRange(LHS).getSignedMin().isMinSignedValue()) {
-      LHS = getAddExpr(getConstant(RHS->getType(), -1, true), LHS,
+      LHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, true), LHS,
                        /*HasNUW=*/false, /*HasNSW=*/true);
       Pred = ICmpInst::ICMP_SLT;
       Changed = true;
@@ -4960,7 +4960,7 @@
     break;
   case ICmpInst::ICMP_SGE:
     if (!getSignedRange(RHS).getSignedMin().isMinSignedValue()) {
-      RHS = getAddExpr(getConstant(RHS->getType(), -1, true), RHS,
+      RHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, true), RHS,
                        /*HasNUW=*/false, /*HasNSW=*/true);
       Pred = ICmpInst::ICMP_SGT;
       Changed = true;
@@ -4973,12 +4973,12 @@
     break;
   case ICmpInst::ICMP_ULE:
     if (!getUnsignedRange(RHS).getUnsignedMax().isMaxValue()) {
-      RHS = getAddExpr(getConstant(RHS->getType(), 1, false), RHS,
+      RHS = getAddExpr(getConstant(RHS->getType(), 1, true), RHS,
                        /*HasNUW=*/true, /*HasNSW=*/false);
       Pred = ICmpInst::ICMP_ULT;
       Changed = true;
     } else if (!getUnsignedRange(LHS).getUnsignedMin().isMinValue()) {
-      LHS = getAddExpr(getConstant(RHS->getType(), -1, false), LHS,
+      LHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, true), LHS,
                        /*HasNUW=*/true, /*HasNSW=*/false);
       Pred = ICmpInst::ICMP_ULT;
       Changed = true;
@@ -4986,12 +4986,12 @@
     break;
   case ICmpInst::ICMP_UGE:
     if (!getUnsignedRange(RHS).getUnsignedMin().isMinValue()) {
-      RHS = getAddExpr(getConstant(RHS->getType(), -1, false), RHS,
+      RHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, true), RHS,
                        /*HasNUW=*/true, /*HasNSW=*/false);
       Pred = ICmpInst::ICMP_UGT;
       Changed = true;
     } else if (!getUnsignedRange(LHS).getUnsignedMax().isMaxValue()) {
-      LHS = getAddExpr(getConstant(RHS->getType(), 1, false), LHS,
+      LHS = getAddExpr(getConstant(RHS->getType(), 1, true), LHS,
                        /*HasNUW=*/true, /*HasNSW=*/false);
       Pred = ICmpInst::ICMP_UGT;
       Changed = true;





More information about the llvm-commits mailing list