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

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 18 11:59:14 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
----------------
jrbyrnes wrote:

The function decomposes and finds better forms for comparisons by testing for bit conditions of the compared value -> "decomposeBitTest"

The new capability decomposes cases where we bitmask a value via `and` -> "decomposeBitMask"

Does this explanation help, or is it still too confusing?

Either way, "MatchCanonicalForm" seems to be much more vague and isn't really describing what the capability does.

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


More information about the llvm-commits mailing list