blob: cf6d34d888d4ddb4abb25cfd02ad367325509723 [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -S -passes=loop-deletion < %s | FileCheck %s
; Do not try to delete a loop that exits to an EH pad, as we can't directly
; branch to it. We would need a different approach here that still retains
; the invoke.
define i32 @test() mustprogress personality ptr poison {
; CHECK-LABEL: define i32 @test
; CHECK-SAME: () #[[ATTR0:[0-9]+]] personality ptr poison {
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: invoke void @llvm.donothing()
; CHECK-NEXT: to label [[LOOP_LATCH:%.*]] unwind label [[LPAD:%.*]]
; CHECK: lpad:
; CHECK-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
; CHECK-NEXT: resume { ptr, i32 } [[LP]]
; CHECK: loop.latch:
; CHECK-NEXT: br label [[LOOP]]
;
entry:
br label %loop
loop:
invoke void @llvm.donothing()
to label %loop.latch unwind label %lpad
lpad:
%lp = landingpad { ptr, i32 }
cleanup
resume { ptr, i32 } %lp
loop.latch:
br label %loop
}
declare void @llvm.donothing()