[llvm] [InstCombine] Factorise Add and Min/Max using Distributivity (PR #101717)
Marius Kamp via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 17 06:30:30 PDT 2024
================
@@ -1505,6 +1505,80 @@ foldMinimumOverTrailingOrLeadingZeroCount(Value *I0, Value *I1,
ConstantInt::getTrue(ZeroUndef->getType()));
}
+/// Return whether "X LOp (Y ROp Z)" is always equal to
+/// "(X LOp Y) ROp (X LOp Z)".
+static bool foldIntrinsicUsingDistributiveLaws(Instruction::BinaryOps LOp,
----------------
mskamp wrote:
In my opinion, the name of the function is a bit misleading since it doesn't fold anything but rather checks whether we can apply the transformation.
https://github.com/llvm/llvm-project/pull/101717
More information about the llvm-commits
mailing list