When creating a ConstantRange for [n,UINT_MAX], special case n == 0, because
authorDan Gohman <gohman@apple.com>
Sun, 11 Apr 2010 22:12:18 +0000 (22:12 +0000)
committerDan Gohman <gohman@apple.com>
Sun, 11 Apr 2010 22:12:18 +0000 (22:12 +0000)
ConstantRange(0, 0) creates an empty range rather than a full one.

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

lib/Analysis/ScalarEvolution.cpp

index c67cb71b3030fccf88c414c926908b7bbaefa8de..44aa5082b1c1804a8f502719e1d5ce93376a31bd 100644 (file)
@@ -2920,9 +2920,10 @@ ScalarEvolution::getUnsignedRange(const SCEV *S) {
     // initial value.
     if (AddRec->hasNoUnsignedWrap())
       if (const SCEVConstant *C = dyn_cast<SCEVConstant>(AddRec->getStart()))
-        ConservativeResult =
-          ConstantRange(C->getValue()->getValue(),
-                        APInt(getTypeSizeInBits(C->getType()), 0));
+        if (!C->isZero())
+          ConservativeResult =
+            ConstantRange(C->getValue()->getValue(),
+                          APInt(getTypeSizeInBits(C->getType()), 0));
 
     // TODO: non-affine addrec
     if (AddRec->isAffine()) {