[PATCH] D121833: [SelectionDAG][RISCV][AMDGPU][ARM] Improve SimplifyDemandedBits for SHL with variable shift amount.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 11:30:30 PDT 2022


craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon, arsenm, efriedma.
Herald added subscribers: s, VincentWu, luke957, vkmr, frasercrmck, ecnelises, evandro, kerbowa, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, kristof.beyls, arichardson, t-tye, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay, wdng.
Herald added a project: LLVM.

If we have a variable shift amount and the demanded mask has leading
zeros, we can propagate those leading zeros to not demand those bits
from operand 0. This can allow zero_extend/sign_extend to become
any_extend. This pattern can occur due to C integer promotion rules.

This transform is already done by InstCombineSimplifyDemanded.cpp where
sign_extend can be turned into zero_extend for example.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121833

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/AMDGPU/shl.ll
  llvm/test/CodeGen/AMDGPU/shl.v2i16.ll
  llvm/test/CodeGen/RISCV/alu16.ll
  llvm/test/CodeGen/RISCV/alu8.ll
  llvm/test/CodeGen/Thumb2/LowOverheadLoops/while-loops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121833.415913.patch
Type: text/x-patch
Size: 11632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220316/d5c2c125/attachment.bin>


More information about the llvm-commits mailing list