[llvm] IR: introduce struct with CmpInst::Predicate and samesign (PR #116867)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 13:45:13 PST 2024


================
@@ -9342,10 +9340,10 @@ static std::optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
       (LPred == ICmpInst::ICMP_ULT || LPred == ICmpInst::ICMP_UGE) &&
       (RPred == ICmpInst::ICMP_ULT || RPred == ICmpInst::ICMP_UGE) &&
       match(L0, m_c_Add(m_Specific(L1), m_Specific(R1))))
-    return LPred == RPred;
+    return CmpPredicate::getMatching(LPred, RPred).has_value();
 
-  if (LPred == RPred)
-    return isImpliedCondOperands(LPred, L0, L1, R0, R1);
+  if (auto P = CmpPredicate::getMatching(LPred, RPred))
----------------
nikic wrote:

I think this change should have a visible (testable) optimization impact.

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


More information about the llvm-commits mailing list