[llvm] [InstCombine] Combine or-disjoint (and->mul), (and->mul) to and->mul (PR #136013)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 01:08:06 PDT 2025


================
@@ -3593,6 +3593,73 @@ static Value *foldOrOfInversions(BinaryOperator &I,
   return nullptr;
 }
 
+// A decomposition of ((X & Mask) ? 0 : Mask * Factor) . The NUW / NSW bools
+// track these properities for preservation. Note that we can decompose
+// equivalent forms of this expression (e.g. ((X & Mask) * Factor))
----------------
nikic wrote:

FWIW, I think it would make more sense to mention `(X & Mask) * Factor` first, because this is actually the basic form of the pattern -- the select form is the special case that's equivalent but not canonicalized due to unclear individual profitability.

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


More information about the llvm-commits mailing list