[PATCH] D130103: [InstCombine] Add mul with negated power of 2 constant to canEvaluateShifted.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 10:27:17 PDT 2022


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.

If we are right shifting a multiply by a negated power of 2 where
the power of 2 is the same as the shift amount, we can replace with
a negate followed by an And.

New tests have not been committed yet but the patch shows the diffs.
Let me know if you want any changes or additional tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130103

Files:
  llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
  llvm/test/Transforms/InstCombine/apint-shift.ll
  llvm/test/Transforms/InstCombine/shift.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130103.445869.patch
Type: text/x-patch
Size: 4999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220719/833f07af/attachment.bin>


More information about the llvm-commits mailing list