diff options
author | Jessica Paquette <jpaquette@apple.com> | 2021-02-09 17:06:45 -0800 |
---|---|---|
committer | Jessica Paquette <jpaquette@apple.com> | 2021-02-10 13:28:01 -0800 |
commit | 9283058abbec3d2236e69556206b4e66bf52045b (patch) | |
tree | d9759f00dbb77d5a7f8d6ff99dfb0b7ad0634a21 /clang/lib/Frontend/TestModuleFileExtension.cpp | |
parent | bda5e57742237dc38350e59892cf4220ae0de486 (diff) | |
download | llvm-9283058abbec3d2236e69556206b4e66bf52045b.zip llvm-9283058abbec3d2236e69556206b4e66bf52045b.tar.gz llvm-9283058abbec3d2236e69556206b4e66bf52045b.tar.bz2 |
[AArch64][GlobalISel] Fold G_ADD into the cset for G_ICMP
When we have a G_ADD which is fed by a G_ICMP on one side, we can fold it into
the cset for the G_ICMP.
e.g. Given
```
%cmp = G_ICMP ... %x, %y
%add = G_ADD %cmp, %z
```
We would normally emit a cmp, cset, and add.
However, `%add` is either `%z` or `%z + 1`. So, we can just use `%z` as the
source of the cset rather than wzr, saving an instruction.
This would probably be cleaner in AArch64PostLegalizerLowering, but we'd need
to change the way we represent G_ICMP to do that, I think. For now, it's
easiest to implement in selection.
This is a 0.1% code size improvement on CTMark/pairlocalalign at -Os.
Example: https://godbolt.org/z/7KdrP8
Differential Revision: https://reviews.llvm.org/D96388
Diffstat (limited to 'clang/lib/Frontend/TestModuleFileExtension.cpp')
0 files changed, 0 insertions, 0 deletions