Set isSigned to true when creating an all-ones integer constant, even
authorDan Gohman <gohman@apple.com>
Fri, 30 Apr 2010 19:22:39 +0000 (19:22 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 30 Apr 2010 19:22:39 +0000 (19:22 +0000)
for unsigned purposes, so >64-bit integer values get a full all-ones
value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102739 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index d6b4f3fff40a9a09f50e4f9743d7f8b76f909b37..2e7209a4829188468eb1f32f0d8b572e1105717a 100644 (file)
@@ -3948,22 +3948,22 @@ ScalarEvolution::ComputeBackedgeTakenCountFromExitCondICmp(const Loop *L,
     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);
       Cond = ICmpInst::ICMP_ULT;
     } else if (!getUnsignedRange(LHS).getUnsignedMin().isMinValue()) {
-      LHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, false), LHS,
+      LHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, true), LHS,
                        /*HasNUW=*/true, /*HasNSW=*/false);
       Cond = ICmpInst::ICMP_ULT;
     }
     break;
   case ICmpInst::ICMP_UGE:
     if (!getUnsignedRange(RHS).getUnsignedMin().isMinValue()) {
-      RHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, false), RHS,
+      RHS = getAddExpr(getConstant(RHS->getType(), (uint64_t)-1, true), RHS,
                        /*HasNUW=*/true, /*HasNSW=*/false);
       Cond = ICmpInst::ICMP_UGT;
     } 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);
       Cond = ICmpInst::ICMP_UGT;
     }