[llvm] [InstCombine] Tighten use constraint in factorization transforms (PR #102943)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 12:30:16 PDT 2024
================
@@ -1424,6 +1424,12 @@ static Instruction *factorizeMathWithShlOps(BinaryOperator &I,
!match(Op1, m_Shl(m_Value(Y), m_Specific(ShAmt))))
return nullptr;
+ // This transform is only profitiable if both operations or one operation and
+ // the resulting add/sub can be eliminated/folded.
+ if (!(Op0->hasOneUse() && Op1->hasOneUse()) &&
+ !(isa<Constant>(X) && isa<Constant>(Y)))
----------------
goldsteinn wrote:
Probably more precise is `!simplifyBinOp(I.getOpcode(), X, Y)`
https://github.com/llvm/llvm-project/pull/102943
More information about the llvm-commits
mailing list