Issue 183906
Summary [IndVar] Miscompile due to removal of an infinite loop
Labels new issue
Assignees
Reporter pitust
    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


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to