[PATCH] D123453: [InstCombine] Fold mul nuw+lshr exact to a single multiplication when the latter is a factor
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 9 10:50:43 PDT 2022
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp:1177
+ // lshr exact (mul nuw x, (c << ShAmtC)), ShAmtC -> mul nuw x, c
+ if (Op0->hasOneUse() && I.isExact()) {
+ APInt NewMulC = MulC->lshr(ShAmtC);
----------------
1. No one-use check needed, only a single instruction is produced.
2. I believe, while that `lshr` is obviously `exact`, your own proof shows that there is no need to check that it is marked as such?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123453/new/
https://reviews.llvm.org/D123453
More information about the llvm-commits
mailing list