[IndVar] Miscompile due to removal of an infinite loop
Open
loopoptim
miscompilation
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This program is misoptimized by `IndVarSimplifyPass`:
```llvm
define void @func() unnamed_addr {
br label %1
1:
%2 = phi i8 [ 0, %0 ], [ %7, %6 ]
br label %4
3:
ret void
4:
%5 = icmp eq i8 %2, 1
br i1 %5, label %4, label %6
6:
%7 = add nuw i8 %2, 1
%8 = icmp eq i8 %7, -1
br i1 %8, label %3, label %1
}
```
which determines that `%8` is always true and so the branch which breaks out of the loop is always taken.
Compiler explorer: https://godbolt.org/z/EPsrzTz5W
Contributor guide
Assessment
This issue has not been assessed yet.