[PATCH] D146347: [InstCombine] Improve transforms for `(mul X, Y)` -> `(shl X, log2(Y)`

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 18 04:53:21 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:489
+    return replaceInstUsesWith(I, Builder.CreateShl(Op0, Res, I.getName()));
+  }
+
----------------
We should preserve the nuw flag here: https://alive2.llvm.org/ce/z/YkwtoD

We can't preserve nsw due to the INT_MIN edge case: https://alive2.llvm.org/ce/z/HTaC3b


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146347/new/

https://reviews.llvm.org/D146347



More information about the llvm-commits mailing list