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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 28 02:25:52 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);
+        continue;
+      }
+
----------------
fhahn wrote:

I think all non-conditional facts should be handled here, so could we add `llvm_unreachable()` below and remove the extra check `    if (CB.isConditionFact()) {` as a follow-up?

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


More information about the llvm-commits mailing list