[llvm] [ConstraintElim] Add facts implied by llvm.abs (PR #73189)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 03:51:22 PST 2023


================
@@ -1629,6 +1634,11 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT, LoopInfo &LI,
 
     ICmpInst::Predicate Pred;
     if (!CB.isConditionFact()) {
+      if (Value *X; match(CB.Inst, m_Intrinsic<Intrinsic::abs>(m_Value(X)))) {
+        AddFact(CmpInst::ICMP_SGE, CB.Inst, X);
----------------
fhahn wrote:

I think we should also be able to add `CB.Inst >= 0` as a follow-up?

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


More information about the llvm-commits mailing list