diff options
| author | Joseph Tremoulet <jotrem@microsoft.com> | 2016-01-10 04:31:05 +0000 |
|---|---|---|
| committer | Joseph Tremoulet <jotrem@microsoft.com> | 2016-01-10 04:31:05 +0000 |
| commit | 8ea808632238758cb90e049588870321a91756b9 (patch) | |
| tree | e06f6739d13277390c668688e290a98e868b34d8 /llvm/test | |
| parent | 81e81960e36b6c5e6faf80991aacac8d266c9d2e (diff) | |
| download | bcm5719-llvm-8ea808632238758cb90e049588870321a91756b9.tar.gz bcm5719-llvm-8ea808632238758cb90e049588870321a91756b9.zip | |
[WinEH] Disallow cyclic unwinds
Summary:
Funclet-based EH personalities/tables likely can't handle these, and they
can't be generated at source, so make them officially illegal in IR as
well.
Reviewers: andrew.w.kaylor, rnk, majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D15963
llvm-svn: 257274
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/WinEH/wineh-cloning.ll | 42 | ||||
| -rw-r--r-- | llvm/test/Verifier/invalid-eh.ll | 57 |
2 files changed, 57 insertions, 42 deletions
diff --git a/llvm/test/CodeGen/WinEH/wineh-cloning.ll b/llvm/test/CodeGen/WinEH/wineh-cloning.ll index 3c1793a3bd7..748c07df173 100644 --- a/llvm/test/CodeGen/WinEH/wineh-cloning.ll +++ b/llvm/test/CodeGen/WinEH/wineh-cloning.ll @@ -233,48 +233,6 @@ exit: ; CHECK-NEXT: br label %outer.ret -define void @test9() personality i32 (...)* @__C_specific_handler { -entry: - invoke void @f() - to label %invoke.cont unwind label %left -invoke.cont: - invoke void @f() - to label %unreachable unwind label %right -left: - %cp.left = cleanuppad within none [] - call void @llvm.foo(i32 1) - invoke void @f() [ "funclet"(token %cp.left) ] - to label %unreachable unwind label %right -right: - %cp.right = cleanuppad within none [] - call void @llvm.foo(i32 2) - invoke void @f() [ "funclet"(token %cp.right) ] - to label %unreachable unwind label %left -unreachable: - unreachable -} -; This is an irreducible loop with two funclets that enter each other. -; CHECK-LABEL: define void @test9( -; CHECK: entry: -; CHECK: to label %invoke.cont unwind label %[[LEFT:.+]] -; CHECK: invoke.cont: -; CHECK: to label %[[UNREACHABLE_ENTRY:.+]] unwind label %[[RIGHT:.+]] -; CHECK: [[LEFT]]: -; CHECK: call void @llvm.foo(i32 1) -; CHECK: invoke void @f() -; CHECK: to label %[[UNREACHABLE_LEFT:.+]] unwind label %[[RIGHT]] -; CHECK: [[RIGHT]]: -; CHECK: call void @llvm.foo(i32 2) -; CHECK: invoke void @f() -; CHECK: to label %[[UNREACHABLE_RIGHT:.+]] unwind label %[[LEFT]] -; CHECK: [[UNREACHABLE_RIGHT]]: -; CHECK: unreachable -; CHECK: [[UNREACHABLE_LEFT]]: -; CHECK: unreachable -; CHECK: [[UNREACHABLE_ENTRY]]: -; CHECK: unreachable - - define void @test10() personality i32 (...)* @__CxxFrameHandler3 { entry: invoke void @f() diff --git a/llvm/test/Verifier/invalid-eh.ll b/llvm/test/Verifier/invalid-eh.ll index e5ad2abfb5e..af3d987a39b 100644 --- a/llvm/test/Verifier/invalid-eh.ll +++ b/llvm/test/Verifier/invalid-eh.ll @@ -15,6 +15,8 @@ ; RUN: sed -e s/.T15:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK15 %s ; RUN: sed -e s/.T16:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK16 %s ; RUN: sed -e s/.T17:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK17 %s +; RUN: sed -e s/.T18:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK18 %s +; RUN: sed -e s/.T19:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK19 %s declare void @g() @@ -282,3 +284,58 @@ declare void @g() ;T17: cleanuppad within none [] ;T17: unreachable ;T17: } + +;T18: define void @f() personality void ()* @g { +;T18: entry: +;T18: invoke void @g() +;T18: to label %invoke.cont unwind label %left +;T18: invoke.cont: +;T18: invoke void @g() +;T18: to label %unreachable unwind label %right +;T18: left: +;T18: %cp.left = cleanuppad within none [] +;T18: invoke void @g() [ "funclet"(token %cp.left) ] +;T18: to label %unreachable unwind label %right +;T18: right: +;T18: %cp.right = cleanuppad within none [] +;T18: invoke void @g() [ "funclet"(token %cp.right) ] +;T18: to label %unreachable unwind label %left +;T18: ; CHECK18: EH pads can't handle each other's exceptions +;T18: ; CHECK18-NEXT: %cp.left = cleanuppad within none [] +;T18: ; CHECK18-NEXT: invoke void @g() [ "funclet"(token %cp.left) ] +;T18: ; CHECK18-NEXT: to label %unreachable unwind label %right +;T18: ; CHECK18-NEXT: %cp.right = cleanuppad within none [] +;T18: ; CHECK18-NEXT: invoke void @g() [ "funclet"(token %cp.right) ] +;T18: ; CHECK18-NEXT: to label %unreachable unwind label %left +;T18: unreachable: +;T18: unreachable +;T18: } + +;T19: define void @f() personality void ()* @g { +;T19: entry: +;T19: ret void +;T19: red: +;T19: %redpad = cleanuppad within none [] +;T19: unreachable +;T19: red.inner: +;T19: %innerpad = cleanuppad within %redpad [] +;T19: invoke void @g() [ "funclet"(token %innerpad) ] +;T19: to label %unreachable unwind label %green +;T19: green: +;T19: %greenswitch = catchswitch within none [label %catch] unwind label %blue +;T19: catch: +;T19: catchpad within %greenswitch [i32 42] +;T19: unreachable +;T19: blue: +;T19: %bluepad = cleanuppad within none [] +;T19: cleanupret from %bluepad unwind label %red +;T19: ; CHECK19: EH pads can't handle each other's exceptions +;T19: ; CHECK19-NEXT: %redpad = cleanuppad within none [] +;T19: ; CHECK19-NEXT: invoke void @g() [ "funclet"(token %innerpad) ] +;T19: ; CHECK19-NEXT: to label %unreachable unwind label %green +;T19: ; CHECK19-NEXT: %greenswitch = catchswitch within none [label %catch] unwind label %blue +;T19: ; CHECK19-NEXT: %bluepad = cleanuppad within none [] +;T19: ; CHECK19-NEXT: cleanupret from %bluepad unwind label %red +;T19: unreachable: +;T19: unreachable +;T19: } |

