[PATCH] D97160: [DAGCombiner] Optimize SMULO/UMULO if we can prove that overflow is impossible.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 21 11:58:29 PST 2021


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel.
Herald added subscribers: frasercrmck, ecnelises, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

Using ComputeNumSignBits or computeKnownBits we might be able
to determine that overflow is impossible.

This especially helps after type legalization if the type was
promoted from a type with half the bits or more. Type legalization
conservatively creates a promoted smulo/umulo and an overflow
check for the promoted bits. The overflow from the promoted
smulo/umulo is ORed with the result of the promoted bits
overflow check. Proving that the promoted smulo/umulo can never
overflow will leave us with just the promoted bits overflow check.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97160

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AArch64/vec_umulo.ll
  llvm/test/CodeGen/RISCV/xaluo.ll
  llvm/test/CodeGen/X86/vec_smulo.ll
  llvm/test/CodeGen/X86/vec_umulo.ll
  llvm/test/CodeGen/X86/xmulo.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97160.325329.patch
Type: text/x-patch
Size: 32319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210221/f4a0e71d/attachment.bin>


More information about the llvm-commits mailing list