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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 03:56:39 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 =
----------------
fhahn wrote:

If the above works out, it may make sense to make the `MayIncludeUndef` argument for `ValueLatticeElement::getRange()` required or flip the default?

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


More information about the llvm-commits mailing list