[all-commits] [llvm/llvm-project] 32ad45: [InstCombine] Add test cases from PR62898. NFC.
Yingwei Zheng via All-commits
all-commits at lists.llvm.org
Sun Sep 10 11:27:56 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 32ad45556e9c673d2b6daba4a3b7993ad4e8e9ac
https://github.com/llvm/llvm-project/commit/32ad45556e9c673d2b6daba4a3b7993ad4e8e9ac
Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: 2023-09-11 (Mon, 11 Sep 2023)
Changed paths:
M llvm/test/Transforms/InstCombine/smax-icmp.ll
M llvm/test/Transforms/InstCombine/smin-icmp.ll
M llvm/test/Transforms/InstCombine/umax-icmp.ll
M llvm/test/Transforms/InstCombine/umin-icmp.ll
Log Message:
-----------
[InstCombine] Add test cases from PR62898. NFC.
This patch adds some test cases from https://github.com/llvm/llvm-project/issues/62898.
As nikic noted in the issue, we should start by implementing a generalization of the fold `smin(X, Y) < Z -> X < Z` when `Y > Z` is implied by constant folds/invariants/dom conditions.
```
define i1 @src(i32 %x, i32 %y, i32 %z) {
%cmp = icmp sgt i32 %y, %z
br i1 %cmp, label %if, label %end
if:
%cond = call i32 @llvm.smin.i32(i32 %x, i32 %y)
%tobool = icmp slt i32 %cond, %z
ret i1 %tobool
end:
ret i1 false
}
define i1 @tgt(i32 %x, i32 %y, i32 %z) {
%cmp = icmp sgt i32 %y, %z
br i1 %cmp, label %if, label %end
if:
%tobool = icmp slt i32 %x, %z
ret i1 %tobool
end:
ret i1 false
}
declare i32 @llvm.smin.i32(i32, i32)
```
Alive2: https://alive2.llvm.org/ce/z/dK9vXz
This patch also adds some generalized test cases like the above.
Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D156227
Commit: 44e5afdb91b92dedfbd3100a3e73dab27de1c9cf
https://github.com/llvm/llvm-project/commit/44e5afdb91b92dedfbd3100a3e73dab27de1c9cf
Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: 2023-09-11 (Mon, 11 Sep 2023)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
M llvm/test/Transforms/InstCombine/smax-icmp.ll
M llvm/test/Transforms/InstCombine/smin-icmp.ll
M llvm/test/Transforms/InstCombine/umax-icmp.ll
M llvm/test/Transforms/InstCombine/umin-icmp.ll
M llvm/test/Transforms/LoopVectorize/X86/pr23997.ll
M llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
Log Message:
-----------
[InstCombine] Generalize foldICmpWithMinMax
This patch generalizes the fold of `icmp pred min/max(X, Y), Z` to address the issue https://github.com/llvm/llvm-project/issues/62898.
For example, we can fold `smin(X, Y) < Z` into `X < Z` when `Y > Z` is implied by constant folds/invariants/dom conditions.
Alive2 (with `--disable-undef-input` due to the limitation of --smt-to=10000): https://alive2.llvm.org/ce/z/rB7qLc
You can run the standalone translation validation tool `alive-tv` locally to verify these transformations.
```
alive-tv transforms.ll --smt-to=600000 --exit-on-error
```
Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D156238
Compare: https://github.com/llvm/llvm-project/compare/fd453e2381d6...44e5afdb91b9
More information about the All-commits
mailing list