[llvm] [LVI][CVP] Treat undef as Unknown on abs (PR #68711)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 02:33:15 PDT 2023


================
@@ -479,7 +479,8 @@ static bool processAbsIntrinsic(IntrinsicInst *II, LazyValueInfo *LVI) {
 
   // Is X in [0, IntMin]?  NOTE: INT_MIN is fine!
   Result = LVI->getPredicateAt(CmpInst::Predicate::ICMP_ULE, X, IntMin, II,
-                               /*UseBlockValue=*/true);
+                               /*UseBlockValue=*/true,
+                               /*UndefAllowed*/ IsIntMinPoison);
----------------
nikic wrote:

I'd prefer to switch these to use `getConstantRange()` instead and then do an icmp on the range. Especially as we are doing multiple comparisons on the same range.

This is slightly weaker than getPredicateAt() in some cases, but I don't think it matters here, and it will reduce API changes.

https://github.com/llvm/llvm-project/pull/68711


More information about the llvm-commits mailing list