[all-commits] [llvm/llvm-project] 9a61e7: [GlobalISel] Combine (G_*ADDO x, 0) -> x + no carr...

Jessica Paquette via All-commits all-commits at lists.llvm.org
Thu Feb 3 14:31:25 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a61e731ff4c2b7e19438efa277b8712d4431b04
      https://github.com/llvm/llvm-project/commit/9a61e731ff4c2b7e19438efa277b8712d4431b04
  Author: Jessica Paquette <jpaquette at apple.com>
  Date:   2022-02-03 (Thu, 03 Feb 2022)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    A llvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-addo-zero.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/saddsat.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/ssubsat.ll

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

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

Differential Revision: https://reviews.llvm.org/D118655




More information about the All-commits mailing list