[PATCH] D118655: [GlobalISel] Combine (G_*ADDO x, 0) -> x + no carry out

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 14:20:39 PST 2022


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

Similar to the G_*MULO change.

The code for checking if a constant is legal/pre-legalize is shared between these, and is kind of hairy. So, factor it out into a new function: `isConstantLegalOrBeforeLegalizer`.

To make the refactoring clean, further refactor `isLegalOrBeforeLegalizer` into a wrapper for two functions:

- `isPreLegalize`
- `isLegal`

This is a bit easier to read in general.

https://godbolt.org/z/KW7oszP1o


https://reviews.llvm.org/D118655

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/prelegalizer-combiner-addo-zero.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/saddsat.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/ssubsat.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118655.404729.patch
Type: text/x-patch
Size: 159304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220131/b659bd97/attachment-0001.bin>


More information about the llvm-commits mailing list