[llvm] [SCEV] Add special handling for phi when BranchInst's edge doesn't dominate use in phi (PR #163146)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 24 12:21:07 PDT 2025
https://github.com/efriedma-quic commented:
Actually, I'm not understanding the pattern. Can you write it in Alive2? I got as far as the following (https://alive2.llvm.org/ce/z/7WAcTS):
```
define i32 @src(i32 %a, i1 %p) {
entry:
%b = and i32 %a, 31
%c = icmp eq i32 %b, 0
br i1 %c, label %cmp_true, label %cmp_false
cmp_false:
br i1 %p, label %cmp_true, label %merge
cmp_true:
br label %merge
merge:
%d = phi i32 [32, %cmp_true], [%b, %cmp_false]
ret i32 %d
}
define i32 @tgt(i32 %a, i1 %p) {
%b = and i32 %a, 31
%add = add i32 %a, 1
%max = call i32 @llvm.umax.i32(i32 %add, i32 1)
ret i32 %max
}
```
https://github.com/llvm/llvm-project/pull/163146
More information about the llvm-commits
mailing list