[llvm] [CmpInstAnalysis] Decompose icmp eq (and x, C) C2 (PR #136367)
Jeffrey Byrnes via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 18 13:38:22 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
+ /// decompose bitmasking (e.g. implemented via `and`).
std::optional<DecomposedBitTest>
decomposeBitTestICmp(Value *LHS, Value *RHS, CmpInst::Predicate Pred,
- bool LookThroughTrunc = true,
- bool AllowNonZeroC = false);
+ bool LookThroughTrunc = true, bool AllowNonZeroC = false,
+ bool DecomposeBitMask = false);
----------------
jrbyrnes wrote:
There is concern about naming of `DecomposeBitMask` -- see https://github.com/llvm/llvm-project/pull/135274
https://github.com/llvm/llvm-project/pull/136367
More information about the llvm-commits
mailing list