[llvm] 6ab663b - [LVI] Require UndefAllowed argument to getConstantRangeAtUse() (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 03:46:30 PST 2023


Author: Nikita Popov
Date: 2023-12-12T12:45:49+01:00
New Revision: 6ab663be8da2b2f0a3a59d1ab6935100fb832049

URL: https://github.com/llvm/llvm-project/commit/6ab663be8da2b2f0a3a59d1ab6935100fb832049
DIFF: https://github.com/llvm/llvm-project/commit/6ab663be8da2b2f0a3a59d1ab6935100fb832049.diff

LOG: [LVI] Require UndefAllowed argument to getConstantRangeAtUse() (NFC)

For the remaining uses set it to true, matching the current
behavior.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/LazyValueInfo.h
    llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/LazyValueInfo.h b/llvm/include/llvm/Analysis/LazyValueInfo.h
index bf2fc47fa642d5..cb5fa35d299510 100644
--- a/llvm/include/llvm/Analysis/LazyValueInfo.h
+++ b/llvm/include/llvm/Analysis/LazyValueInfo.h
@@ -99,7 +99,7 @@ namespace llvm {
 
     /// Return the ConstantRange constraint that is known to hold for the value
     /// at a specific use-site.
-    ConstantRange getConstantRangeAtUse(const Use &U, bool UndefAllowed = true);
+    ConstantRange getConstantRangeAtUse(const Use &U, bool UndefAllowed);
 
     /// Determine whether the specified value is known to be a
     /// constant on the specified edge.  Return null if not.

diff  --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index e6d8f89122ff68..d2dfc764d042bb 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -278,8 +278,10 @@ static bool processICmp(ICmpInst *Cmp, LazyValueInfo *LVI) {
   ICmpInst::Predicate UnsignedPred =
       ConstantRange::getEquivalentPredWithFlippedSignedness(
           Cmp->getPredicate(),
-          LVI->getConstantRangeAtUse(Cmp->getOperandUse(0)),
-          LVI->getConstantRangeAtUse(Cmp->getOperandUse(1)));
+          LVI->getConstantRangeAtUse(Cmp->getOperandUse(0),
+                                     /*UndefAllowed*/ true),
+          LVI->getConstantRangeAtUse(Cmp->getOperandUse(1),
+                                     /*UndefAllowed*/ true));
 
   if (UnsignedPred == ICmpInst::Predicate::BAD_ICMP_PREDICATE)
     return false;


        


More information about the llvm-commits mailing list