[PATCH] D103756: [DAG] Allow isNullOrNullSplat to see truncated zeroes

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 5 11:51:27 PDT 2021


dmgreen created this revision.
dmgreen added reviewers: efriedma, david-arm, sdesmalen, NickGuy, t.p.northover, RKSimon, craig.topper.
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, kristof.beyls.
dmgreen requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

This sets the AllowTruncation flag on isConstOrConstSplat in isNullOrNullSplat, allowing it to see truncated constant zeroes on architectures such as AArch64, where only a i32.i64 are legal. As a truncation of 0 is always 0, this should always be valid, allowing some extra folding to happen including some of the cases from D103755 <https://reviews.llvm.org/D103755>.

Whilst I'm here also add a call to peekThroughBitcasts as bitcast Zero is still Zero, and removed a related TODO comment from isOneOrOneSplat as the bitcast of 1 isn't always still 1.


https://reviews.llvm.org/D103756

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/test/CodeGen/AArch64/neon-shift-neg.ll
  llvm/test/CodeGen/AArch64/vecreduce-bool.ll
  llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vrem-sdnode-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vrem-sdnode-rv64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103756.350071.patch
Type: text/x-patch
Size: 18654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210605/3d735578/attachment.bin>


More information about the llvm-commits mailing list