[PATCH] D110662: [GlobalISel] Combine mulo x, 2 -> addo x, x

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 15:09:05 PDT 2021


paquette created this revision.
paquette added reviewers: aemerson, arsenm, jroelofs.
Herald added subscribers: steven.zhang, hiraditya, rovka.
paquette requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

Similar to what SDAG does when it sees a smulo/umulo against 2 (see: `DAGCombiner::visitMULO`)

This pattern is fairly common in Swift code AFAICT.

Here's an example extracted from a Swift testcase:

https://godbolt.org/z/6cT8Mesx7


https://reviews.llvm.org/D110662

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/combine-mulo-with-2.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110662.375718.patch
Type: text/x-patch
Size: 7781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210928/4f27f6df/attachment.bin>


More information about the llvm-commits mailing list