mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 18:16:06 +00:00

Unconditionally removing landing pads results in invalid IR, if there is a different `invoke` that uses it. Update the code to only remove the landing pad if the current invoke is the only user. Also carefully avoid creating plain branches to bbs with landing pads we couldn't remove. Reviewed By: arsenm, aeubanks Differential Revision: https://reviews.llvm.org/D138072
38 lines
852 B
LLVM
38 lines
852 B
LLVM
; RUN: llvm-reduce --delta-passes=basic-blocks --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -abort-on-invalid-reduction -o %t
|
|
; RUN: FileCheck <%t %s
|
|
|
|
; CHECK-INTERESTINGNESS: call void @foo()
|
|
|
|
; CHECK: define void @test() personality ptr null {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: br label %cont
|
|
; CHECK-EMPTY:
|
|
; CHECK-NEXT: cont:
|
|
; CHECK-NEXT: br label %exit
|
|
; CHECK-EMPTY:
|
|
; CHECK-NEXT: exit:
|
|
; CHECK-NEXT: call void @foo()
|
|
; CHECK-NEXT: ret void
|
|
; CHECK-NEXT: }
|
|
|
|
define void @test() personality ptr null {
|
|
entry:
|
|
invoke void @foo()
|
|
to label %cont unwind label %lpad
|
|
|
|
cont:
|
|
invoke void @foo()
|
|
to label %exit unwind label %lpad
|
|
|
|
lpad:
|
|
%0 = landingpad { ptr, i32 }
|
|
cleanup
|
|
ret void
|
|
|
|
exit:
|
|
call void @foo()
|
|
ret void
|
|
}
|
|
|
|
declare void @foo()
|