llvm-project/llvm/test/tools/llvm-reduce/remove-bbs-sequence.ll
Matt Arsenault f02bc70c7d llvm-reduce: Fix producing invalid reductions with landingpads
It's not valid to simply branch to a landingpad block, so it
needs to be removed.

Also stop trying to scan forward to find a block that can be merged.
The predecessor merge rules are more complex than this. This also
would need to have considered landingpads. Just do the minimum
to delete the block, and let the simplify-cfg reduction handle
the branch chain cleanups.
2022-10-28 17:07:26 -07:00

29 lines
725 B
LLVM

; RUN: llvm-reduce -abort-on-invalid-reduction --delta-passes=basic-blocks,simplify-cfg --test %python --test-arg %p/remove-bbs-sequence.py %s -o %t
; RUN: FileCheck %s < %t
; The interestingness test is that the CFG contains a loop. Verify that the
; unnecessary bb2 and bb3 are removed while still maintaining a loop.
define void @main() {
bb0:
br label %bb1
bb1:
br label %bb2
bb2:
br label %bb3
bb3:
%phi = phi i32 [ undef, %bb2 ]
br label %bb4
bb4:
br label %bb1
}
; CHECK:define void @main() {
; CHECK-NEXT: bb0:
; CHECK-NEXT: br label %bb4
; CHECK-EMPTY:
; CHECK-NEXT: bb4:
; CHECK-NEXT: %phi = phi i32 [ undef, %bb0 ], [ undef, %bb4 ]
; CHECK-NEXT: br label %bb4
; CHECK-NEXT:}