[PATCH] D151799: [ConstraintElim] Try to use first cmp to prove second cmp for ANDs.
Antonio Frighetto via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 09:26:44 PDT 2023
antoniofrighetto added a comment.
LG! Perhaps worth to add something along these lines?
define i1 @test_icmp_proved_by_previous_icmp(i64 %x, i64 %y, i64 %z) {
%assumption = icmp sgt i64 %y, %z
call void @llvm.assume(i1 %assumption) ; assume y > z
%1 = icmp sgt i64 %x, %y ; check if x > y
%2 = icmp sgt i64 %x, %z ; check if x > z
%cond = and i1 %1, %2
br i1 %cond, label %t1, label %f1
t1:
ret i1 true
f1:
ret i1 false
}
As `x > z` is implied, the second `icmp` should always be true.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151799/new/
https://reviews.llvm.org/D151799
More information about the llvm-commits
mailing list