[PATCH] D134684: [LegalizeTypes][AMDGPU][Mips][RISCV][X86] Mask shift amounts in ExpandShiftWithUnknownAmountBit.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 16:58:51 PDT 2022


craig.topper created this revision.
craig.topper added reviewers: efriedma, jrtc27, RKSimon, spatel, arsenm.
Herald added subscribers: kosarev, sunshaoce, VincentWu, StephenFan, vkmr, frasercrmck, evandro, kerbowa, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, javed.absar, hiraditya, arichardson, t-tye, tpr, dstuttard, yaxunl, jvesely, kzhuravl, sdardis.
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 the expanded shift will become a libcall we should not pass
out of range shift amounts that did not exist in the original code.

If we're not making a libcall, an out of bounds shift amount would
produce poison, but the selects would block it from propagating. I
think. Though we didn't freeze the shift amount so I'm really not sure.

It's kind of ugly to detect that we're going to make a libcall at this
stage. We'd need to repeat code from ExpandIntRes_Shift and change the
interface of TLI.shouldExpandShift. For now I've taken the simple
approach and always added the mask. Many of the changed tests are
i128 on a 32-bit target which likely isn't exposed to C language code
other than _BitInt.

Fixes PR57988.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134684

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  llvm/test/CodeGen/AMDGPU/shift-i128.ll
  llvm/test/CodeGen/Mips/llvm-ir/ashr.ll
  llvm/test/CodeGen/Mips/llvm-ir/lshr.ll
  llvm/test/CodeGen/Mips/llvm-ir/shl.ll
  llvm/test/CodeGen/RISCV/shifts.ll
  llvm/test/CodeGen/SystemZ/shift-12.ll
  llvm/test/CodeGen/X86/scheduler-backtracking.ll
  llvm/test/CodeGen/X86/shift-i128.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134684.463052.patch
Type: text/x-patch
Size: 248973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220926/f7967f97/attachment-0001.bin>


More information about the llvm-commits mailing list