[llvm] [InstCombine] Combine and->cmp->sel->or-disjoint into and->mul (PR #135274)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 14:13:14 PDT 2025


================
@@ -96,10 +97,27 @@ llvm::decomposeBitTestICmp(Value *LHS, Value *RHS, CmpInst::Predicate Pred,
     Pred = ICmpInst::getStrictPredicate(Pred);
   }
 
+  auto decomposeBitMask =
+      [LHS,
+       LookThruBitSel](CmpInst::Predicate Pred,
+                       const APInt *OrigC) -> std::optional<DecomposedBitTest> {
+    if (!LookThruBitSel)
+      return std::nullopt;
+
+    const APInt *AndC;
+    Value *AndVal;
+    std::optional<DecomposedBitTest> Result = std::nullopt;
+    if (match(LHS, m_And(m_Value(AndVal), m_APInt(AndC))))
----------------
andjo403 wrote:

shall this match only be done for eq/ne? seems like all code that call the bitTest functions expect eq or ne as the predicate. is it a bitTest if some other predicate is used?

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


More information about the llvm-commits mailing list