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

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 16:59:04 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))))
----------------
jrbyrnes wrote:

Sure -- I thought it may be universally useful, but since no clients are using it in that way I have just limited it to eq/ne.

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


More information about the llvm-commits mailing list