diff options
author | Jessica Paquette <jpaquette@apple.com> | 2020-03-19 18:12:18 -0700 |
---|---|---|
committer | Jessica Paquette <jpaquette@apple.com> | 2020-03-23 16:46:03 -0700 |
commit | 02187ed45a4302db5f6721c3233988fef7819701 (patch) | |
tree | 5bddfff45cf41906ffafba5b95e4d36b5178b90c /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | edf6a19adf7acf54f96e78718fb2339e5fcbc444 (diff) | |
download | llvm-02187ed45a4302db5f6721c3233988fef7819701.zip llvm-02187ed45a4302db5f6721c3233988fef7819701.tar.gz llvm-02187ed45a4302db5f6721c3233988fef7819701.tar.bz2 |
[GlobalISel] Combine G_SELECTs of the form (cond ? x : x) into x
When we find something like this:
```
%a:_(s32) = G_SOMETHING ...
...
%select:_(s32) = G_SELECT %cond(s1), %a, %a
```
We can remove the select and just replace it entirely with `%a` because it's
always going to result in `%a`.
Same if we have
```
%select:_(s32) = G_SELECT %cond(s1), %a, %b
```
where we can deduce that `%a == %b`.
This implements the following cases:
- `%select:_(s32) = G_SELECT %cond(s1), %a, %a` -> `%a`
- `%select:_(s32) = G_SELECT %cond(s1), %a, %some_copy_from_a` -> `%a`
- `%select:_(s32) = G_SELECT %cond(s1), %a, %b` -> `%a` when `%a` and `%b`
are defined by identical instructions
This gives a few minor code size improvements on CTMark at -O3 for AArch64.
Differential Revision: https://reviews.llvm.org/D76523
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions