Issue |
146263
|
Summary |
Missed optimization: unconditional ret i1 false not folded in simple control flow with icmp sgt and phi
|
Labels |
new issue
|
Assignees |
|
Reporter |
GINN-Imp
|
The following reduced IR is derived from https://github.com/python/cpython/blob/30ba03ea8ed98522b0500d6856b22727c88e818f/Modules/_json.c#L793
Godbolt: https://godbolt.org/z/4P4KfMsaz
alive2 proof: https://alive2.llvm.org/ce/z/FF_D8Z
```llvm
define noundef i1 @_parse_array_unicode(i64 %0, i1 %1, i64 %2) local_unnamed_addr #0 {
br i1 %1, label %4, label %5
4:
%.not.not = icmp sgt i64 %2, %0
br i1 %.not.not, label %common.ret1, label %5
common.ret1:
%common.ret1.op = phi i1 [ %6, %5 ], [ false, %4 ]
ret i1 %common.ret1.op
5:
%.0 = phi i64 [ %0, %3 ], [ %2, %4 ]
%6 = icmp sgt i64 %.0, %0
br label %common.ret1
}
```
expected:
```llvm
define noundef i1 @tgt(i64 %0, i1 %1, i64 %2) local_unnamed_addr #0 {
ret i1 false
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs