[llvm] [InstCombine] Combine and->cmp->sel->or-disjoint into and->mul (PR #135274)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 18 05:30:32 PDT 2025
================
@@ -95,24 +95,28 @@ namespace llvm {
/// Represents the operation icmp (X & Mask) pred C, where pred can only be
/// eq or ne.
struct DecomposedBitTest {
- Value *X;
+ Value *X = nullptr;
CmpInst::Predicate Pred;
APInt Mask;
APInt C;
};
/// Decompose an icmp into the form ((X & Mask) pred C) if possible.
- /// Unless \p AllowNonZeroC is true, C will always be 0.
+ /// Unless \p AllowNonZeroC is true, C will always be 0. If \p
+ /// DecomposeBitMask is specified, then, for equality predicates, this will
----------------
dtcxzyw wrote:
I recommend landing this change separately. Then we can remove duplicate logic in other places.
https://github.com/llvm/llvm-project/blob/3ed83630b263f667bacd1ef1a65f26d8665c282e/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp#L873-L895
https://github.com/llvm/llvm-project/blob/3ed83630b263f667bacd1ef1a65f26d8665c282e/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp#L2755-L2787
https://github.com/llvm/llvm-project/blob/3ed83630b263f667bacd1ef1a65f26d8665c282e/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L3732-L3765
https://github.com/llvm/llvm-project/pull/135274
More information about the llvm-commits
mailing list