[llvm] [InstCombine] Fold adds + shifts with nsw and nuw flags (PR #88193)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 23:43:11 PDT 2024
================
@@ -1450,9 +1460,24 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
NewMul->setHasNoSignedWrap(true);
return NewMul;
}
+
+ // Special case: lshr nuw (mul (X, 3), 1) -> add nuw nsw (X, lshr(X, 1)
+ if (ShAmtC == 1 && MulC->getZExtValue() == 3) {
----------------
arsenm wrote:
Can you add an alive2 link?
https://github.com/llvm/llvm-project/pull/88193
More information about the llvm-commits
mailing list