[PATCH] D111036: [GlobalISel] Combine G_UMULH x, (1 << c)) -> x >> (bitwidth - c)

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 3 23:08:25 PDT 2021


aemerson created this revision.
aemerson added reviewers: paquette, arsenm, foad.
aemerson added a project: LLVM.
Herald added subscribers: kerbowa, hiraditya, rovka, nhaehnle, jvesely.
aemerson requested review of this revision.
Herald added a subscriber: wdng.

In order to not generate an unnecessary G_CTLZ, I extended the constant folder
in the CSEMIRBuilder to handle G_CTLZ. I also added some extra handing of
vector constants too. It seems we don't have any support for doing constant
folding of vector constants, so the tests show some other useless G_SUB
instructions too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111036

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/CodeGen/GlobalISel/Utils.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/CodeGen/GlobalISel/Utils.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/combine-udiv.ll
  llvm/test/CodeGen/AArch64/GlobalISel/combine-udiv.mir
  llvm/test/CodeGen/AArch64/GlobalISel/combine-umulh-to-lshr.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i32.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i64.ll
  llvm/unittests/CodeGen/GlobalISel/CSETest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111036.376803.patch
Type: text/x-patch
Size: 30482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211004/95c84835/attachment.bin>


More information about the llvm-commits mailing list