diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -195,7 +195,7 @@ Scope->setLifetimeMarker(); // With Windows -EHa, Invoke llvm.seh.scope.begin() for EHCleanup - if (CGF->getLangOpts().EHAsynch && IsEHCleanup && + if (CGF->getLangOpts().EHAsynch && IsEHCleanup && !IsLifetimeMarker && CGF->getTarget().getCXXABI().isMicrosoft()) CGF->EmitSehCppScopeBegin(); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -7151,8 +7151,6 @@ if (types::isCXX(InputType)) CmdArgs.push_back("-fcxx-exceptions"); CmdArgs.push_back("-fexceptions"); - if (EH.Asynch) - CmdArgs.push_back("-fasync-exceptions"); } if (types::isCXX(InputType) && EH.Synch && EH.NoUnwindC) CmdArgs.push_back("-fexternc-nounwind"); diff --git a/clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp b/clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp --- a/clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp +++ b/clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-windows -fasync-exceptions -fcxx-exceptions -fexceptions -fms-extensions -x c++ -Wno-implicit-function-declaration -S -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-windows -fasync-exceptions -fcxx-exceptions -fexceptions -fms-extensions -x c++ -Wno-implicit-function-declaration -O2 -S -emit-llvm %s -o - | FileCheck %s // CHECK: invoke void @llvm.seh.scope.begin() // CHECK: invoke void @llvm.seh.scope.begin() @@ -8,8 +9,8 @@ // CHECK: invoke void @llvm.seh.scope.end() // CHECK: invoke void @llvm.seh.try.begin() -// CHECK: %[[src:[0-9-]+]] = load volatile i32, i32* %i -// CHECK-NEXT: invoke void @"?crash@@YAXH@Z"(i32 %[[src]]) +// CHECK: = load volatile i32, i32* %i +// CHECK-NEXT: invoke void @"?crash@@YAXH@Z"(i32 // CHECK: invoke void @llvm.seh.try.end() // ****************************************************************************