llvm-project/llvm/test/Other/loop-pass-ordering.ll
Lee Wei 1469d82e1c
Remove br i1 undef from some regression tests [NFC] (#115130)
As defined in LangRef, branching on `undef` is undefined behavior.
This PR aims to remove undefined behavior from tests. As UB tests break
Alive2 and may be the root cause of breaking future optimizations.

Here's an Alive2 proof for one of the examples:
https://alive2.llvm.org/ce/z/TncxhP
2024-11-07 08:11:15 +00:00

37 lines
1.0 KiB
LLVM

; RUN: opt -disable-output -debug-pass-manager \
; RUN: -passes='no-op-loop' %s 2>&1 \
; RUN: | FileCheck %s
; @f()
; / \
; loop.0 loop.1
; / \ \
; loop.0.0 loop.0.1 loop.1.0
;
; CHECK: Running pass: NoOpLoopPass on loop %loop.0.0 in function f
; CHECK: Running pass: NoOpLoopPass on loop %loop.0.1 in function f
; CHECK: Running pass: NoOpLoopPass on loop %loop.0 in function f
; CHECK: Running pass: NoOpLoopPass on loop %loop.1.0 in function f
; CHECK: Running pass: NoOpLoopPass on loop %loop.1 in function f
define void @f(i1 %arg) {
entry:
br label %loop.0
loop.0:
br i1 %arg, label %loop.0.0, label %loop.1
loop.0.0:
br i1 %arg, label %loop.0.0, label %loop.0.1
loop.0.1:
br i1 %arg, label %loop.0.1, label %loop.0
loop.1:
br i1 %arg, label %loop.1, label %loop.1.bb1
loop.1.bb1:
br i1 %arg, label %loop.1, label %loop.1.bb2
loop.1.bb2:
br i1 %arg, label %end, label %loop.1.0
loop.1.0:
br i1 %arg, label %loop.1.0, label %loop.1
end:
ret void
}