[PATCH] D110170: [InstCombine] fold cast between shift and mask

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 06:53:01 PDT 2021


spatel created this revision.
spatel added reviewers: lebedev.ri, nikic, mnadeem.
Herald added subscribers: hiraditya, mcrosier.
spatel requested review of this revision.
Herald added a project: LLVM.

and (trunc (lshr X, ShiftC)), C --> and (lshr (trunc X), ShiftC), C

Narrowing the shift should be better for analysis and can lead to follow-on transforms as shown.

Attempt at the general proof in Alive2:
https://alive2.llvm.org/ce/z/tRnnSF

Here are a couple of the specific tests:
https://alive2.llvm.org/ce/z/bCnTp-


https://reviews.llvm.org/D110170

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/and-narrow.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110170.373900.patch
Type: text/x-patch
Size: 4503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210921/539570c9/attachment.bin>


More information about the llvm-commits mailing list