[PATCH] D140347: Revert "Revert "Reland "[TargetLowering] Teach DemandedBits about VSCALE"""

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 13:27:53 PST 2022


compnerd created this revision.
compnerd added reviewers: MacDue, dmgreen, paulwalker-arm.
Herald added subscribers: frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Herald added a project: All.
compnerd requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay.
Herald added a project: LLVM.

This reverts commit 9b92f70d4758f75903ce93feaba5098130820d40 <https://reviews.llvm.org/rG9b92f70d4758f75903ce93feaba5098130820d40>.  The issue
with the re-applied change was an implicit truncation due to the
multiplication.  Although the operations were converted to `APInt`, the
values were implicitly converted to `long` due to the typing rules.
This explicitly sets up the initial value as an `APInt` and then
multiplies the value using the `*=` overload.  The operations are
currently using 64-bit under the assumption that this is sufficiently
wide.  We `(trunc (sext op) 64)` to preserve the signedness of the
operand when performing the multiplication.

Fixes: #59594


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140347

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/AArch64/vscale-and-sve-cnt-demandedbits.ll
  llvm/test/CodeGen/RISCV/vscale-demanded-bits.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140347.484053.patch
Type: text/x-patch
Size: 8398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221219/7e690bad/attachment.bin>


More information about the llvm-commits mailing list