Issue |
134992
|
Summary |
Missed optimization with the `unreachable` information
|
Labels |
new issue
|
Assignees |
|
Reporter |
GINN-Imp
|
The following reduced IR is derived from https://gcc.gnu.org/onlinedocs/gcc-13.2.0/libstdc++/api/a00347_source.html.
More specifically, it comes from function ` _M_default_append` (line 635), and the `unreachable` information corresponds to line 644.
Missed optimization: `store i1 %2, ptr @v, align 1` --> `store i1 false, ptr @v, align 1`
alive2 proof: https://alive2.llvm.org/ce/z/PQDDf2
```llvm
@v = external global i1
define void @src(i8 %0) {
%2 = icmp ugt i8 %0, 5
store i1 %2, ptr @v, align 1
br i1 %2, label %4, label %3
3:
ret void
4:
unreachable
}
```
Godbolt: https://godbolt.org/z/Pxjvz8fxf
clang-trunk -O3 generates:
```llvm
define void @src(i8 %0) local_unnamed_addr #0 {
%2 = icmp ugt i8 %0, 5
store i1 %2, ptr @v, align 1
%3 = xor i1 %2, true
tail call void @llvm.assume(i1 %3)
ret void
}
```
>From the IR generated after clang optimization, it is possible that it can be fixed in the same way as #134540. If you can confirm that they are missed for the same reason, we would like to merge these two issues, thank you very much.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs