[PATCH] D156227: [InstCombine] Add test cases from PR62898. NFC.
Yingwei Zheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 25 04:04:17 PDT 2023
dtcxzyw created this revision.
dtcxzyw added reviewers: nikic, efriedma, spatel.
Herald added a subscriber: StephenFan.
Herald added a project: All.
dtcxzyw requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D156227
Files:
llvm/test/Transforms/InstCombine/smax-icmp.ll
llvm/test/Transforms/InstCombine/smin-icmp.ll
llvm/test/Transforms/InstCombine/umax-icmp.ll
llvm/test/Transforms/InstCombine/umin-icmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156227.543914.patch
Type: text/x-patch
Size: 47753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230725/111fed2a/attachment.bin>
More information about the llvm-commits
mailing list