[llvm] [SCCP] Relax 2-insts range check to one-icmp check (PR #187997)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 12:48:28 PDT 2026


================
@@ -105,6 +105,112 @@ static ConstantRange getRange(Value *Op, SCCPSolver &Solver,
                                                        /*UndefAllowed=*/false);
 }
 
+/// SCCP already proves x \in KnownCR, so only ActiveCmpCR = CmpCR ∩ KnownCR
+/// matters. Try to replace CmpCR with a simpler equivalent range NewCmpCR
+/// such that NewCmpCR ∩ KnownCR == ActiveCmpCR.
----------------
dtcxzyw wrote:

`CmpCR.inverse() ∩ KnownCR` also matters.
```suggestion
/// such that NewCmpCR ∩ KnownCR == CmpCR ∩ KnownCR && NewCmpCR.inverse() ∩ KnownCR == CmpCR.inverse() ∩ KnownCR.
```


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


More information about the llvm-commits mailing list