[PATCH] D124369: [InstCombine] C0 >>{ashr, exact} (X - C1) --> (C0 << C1) >>{ashr} X

Nicolas Abram via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 14:07:54 PDT 2022


nico-abram updated this revision to Diff 425026.
nico-abram added a comment.

I collapsed all three into `InstCombinerImpl::commonShiftTransforms`, right below the pre-existing pre-shift combine.

Had to add setHasNoSignedWrap(false); for the Shl case. Otherwise the @shl_nsw_add_negative test case was generating a `shl nsw i32 1` instead of `shl i32 1`. Not entirely sure why, possibly because I'm genering the Op with `BinaryOperator::Create(I.getOpcode()`?


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

https://reviews.llvm.org/D124369

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124369.425026.patch
Type: text/x-patch
Size: 6795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220425/648a8746/attachment.bin>


More information about the llvm-commits mailing list