[llvm] [SCCP] Don't allow undef ranges when performing operations (PR #93163)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 05:01:01 PDT 2024


================
@@ -1534,8 +1535,10 @@ void SCCPInstVisitor::visitBinaryOperator(Instruction &I) {
     return markOverdefined(&I);
 
   // Try to simplify to a constant range.
-  ConstantRange A = getConstantRange(V1State, I.getType());
-  ConstantRange B = getConstantRange(V2State, I.getType());
+  ConstantRange A =
+      getConstantRange(V1State, I.getType(), /*UndefAllowed=*/false);
+  ConstantRange B =
----------------
nikic wrote:

Worth noting that the "treat undef as full range" approach is also what we do in LVI.

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


More information about the llvm-commits mailing list