diff options
author | Monad <yanwqmonad@gmail.com> | 2024-05-07 10:06:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 11:06:52 +0900 |
commit | 0ab4458df0688955620b72cc2c72a32dffad3615 (patch) | |
tree | 0c4051b8ba954ba9e8cb32afab8d68b1562f70f9 /clang/unittests/Format/FormatTestJava.cpp | |
parent | fd0ffb74389d6bf52c5c2afc8cd0a4e26cfa6c2f (diff) | |
download | llvm-0ab4458df0688955620b72cc2c72a32dffad3615.zip llvm-0ab4458df0688955620b72cc2c72a32dffad3615.tar.gz llvm-0ab4458df0688955620b72cc2c72a32dffad3615.tar.bz2 |
[InstCombine] Fold `cttz(lshr(-1, x) + 1)` to `width - x` (#91244)
Fold
``` llvm
define i64 @src(i64 %50) {
%52 = lshr i64 -1, %50
%53 = add i64 %52, 1
%54 = call i64 @llvm.cttz.i64(i64 %53, i1 false)
ret i64 %54
}
```
to
``` llvm
define i64 @tgt(i64 %50) {
%52 = sub i64 64, %50
ret i64 %52
}
```
as
https://github.com/llvm/llvm-project/pull/91171#pullrequestreview-2040663002
pointed out.
Alive2 proof: https://alive2.llvm.org/ce/z/2aHfYa
Note: the `ctlz` version of this pattern seems not exist in dtcxzyw's
benchmark, so put it aside for now.
Diffstat (limited to 'clang/unittests/Format/FormatTestJava.cpp')
0 files changed, 0 insertions, 0 deletions