diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-04-22 23:39:15 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-04-22 23:39:15 +0000 |
commit | 7d4bc9c0fb925df6dc812969cb9aa7aa2ec2fd35 (patch) | |
tree | 96c9f1f2fc65b2c54d2a6eef445aad17c93358a7 /clang | |
parent | 15823d49b61fc7ddafc2cb10b12f4498d53fb216 (diff) | |
download | bcm5719-llvm-7d4bc9c0fb925df6dc812969cb9aa7aa2ec2fd35.tar.gz bcm5719-llvm-7d4bc9c0fb925df6dc812969cb9aa7aa2ec2fd35.zip |
[WinEH] Don't emit an exceptional cleanup for llvm.eh.endcatch
These extra endcatch markers aren't helping identify regions to outline,
so let's get rid of them. LLVM outlines (more or less) from begincatch
to endcatch. Any unwind edge from an enclosed invoke is a transition to
a new exception handler, which has it's own outlining markers.
llvm-svn: 235562
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/MicrosoftCXXABI.cpp | 5 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp | 36 |
2 files changed, 38 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index f00cd9c81df..42135954bbd 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -814,7 +814,7 @@ void MicrosoftCXXABI::emitBeginCatch(CodeGenFunction &CGF, if (!CatchParam || !CatchParam->getDeclName()) { llvm::Value *Args[2] = {Exn, llvm::Constant::getNullValue(CGF.Int8PtrTy)}; CGF.EmitNounwindRuntimeCall(BeginCatch, Args); - CGF.EHStack.pushCleanup<CallEndCatchMSVC>(NormalAndEHCleanup); + CGF.EHStack.pushCleanup<CallEndCatchMSVC>(NormalCleanup); return; } @@ -823,8 +823,7 @@ void MicrosoftCXXABI::emitBeginCatch(CodeGenFunction &CGF, CGF.Builder.CreateBitCast(var.getObjectAddress(CGF), CGF.Int8PtrTy); llvm::Value *Args[2] = {Exn, ParamAddr}; CGF.EmitNounwindRuntimeCall(BeginCatch, Args); - // FIXME: Do we really need exceptional endcatch cleanups? - CGF.EHStack.pushCleanup<CallEndCatchMSVC>(NormalAndEHCleanup); + CGF.EHStack.pushCleanup<CallEndCatchMSVC>(NormalCleanup); CGF.EmitAutoVarCleanups(var); } diff --git a/clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp b/clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp index 292fad2e4d6..d7268bf3852 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-eh-catch.cpp @@ -116,3 +116,39 @@ extern "C" void fn_with_exc_spec() throw(int) { // WIN64-LABEL: define void @fn_with_exc_spec() // WIN64: call void @might_throw() // WIN64-NEXT: ret void + +extern "C" void catch_nested() { + try { + might_throw(); + } catch (int) { + try { + might_throw(); + } catch (int) { + might_throw(); + } + } +} + +// WIN64-LABEL: define void @catch_nested() +// WIN64: invoke void @might_throw() +// WIN64-NEXT: to label %[[cont1:[^ ]*]] unwind label %[[lp1:[^ ]*]] +// WIN64: [[cont1]] +// +// WIN64: [[lp1]] +// WIN64: landingpad { i8*, i32 } +// WIN64: call void @llvm.eh.begincatch(i8* %{{.*}}, i8* null) +// WIN64: invoke void @might_throw() +// WIN64-NEXT: to label %[[cont2:[^ ]*]] unwind label %[[lp2:[^ ]*]] +// +// WIN64: [[cont2]] +// WIN64-NEXT: br label %[[trycont:[^ ]*]] +// +// WIN64: [[lp2]] +// WIN64: landingpad { i8*, i32 } +// WIN64: call void @llvm.eh.begincatch(i8* %{{.*}}, i8* null) +// WIN64-NEXT: call void @might_throw() +// WIN64-NEXT: call void @llvm.eh.endcatch() +// WIN64-NEXT: br label %[[trycont]] +// +// WIN64: [[trycont]] +// WIN64: call void @llvm.eh.endcatch() |