[llvm] [InstCombine] Factorise Add and Min/Max using Distributivity (PR #101717)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 06:18:17 PDT 2024
================
@@ -1503,6 +1503,76 @@ 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 leftDistributesOverRight(Instruction::BinaryOps LOp, bool hasNUW,
+ bool hasNSW, Intrinsic::ID ROp) {
----------------
dtcxzyw wrote:
```suggestion
static bool leftDistributesOverRight(Instruction::BinaryOps LOp, bool HasNUW,
bool HasNSW, Intrinsic::ID ROp) {
```
https://github.com/llvm/llvm-project/pull/101717
More information about the llvm-commits
mailing list