diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp index dce94a9e9ef7..ee5da3169427 100644 --- a/llvm/lib/Target/X86/X86WinEHState.cpp +++ b/llvm/lib/Target/X86/X86WinEHState.cpp @@ -425,6 +425,10 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) { BasicBlock *FuncletEntryBB = BBColors.front(); if (auto *FuncletPad = dyn_cast(FuncletEntryBB->getFirstNonPHI())) { + // We do not support nesting funclets within cleanuppads. + if (isa(FuncletPad)) + continue; + auto BaseStateI = FuncInfo.FuncletBaseStateMap.find(FuncletPad); if (BaseStateI != FuncInfo.FuncletBaseStateMap.end()) BaseState = BaseStateI->second; diff --git a/llvm/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll b/llvm/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll index f5889f03965b..a18e412255e3 100644 --- a/llvm/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll +++ b/llvm/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll @@ -44,7 +44,6 @@ entry: to label %exit unwind label %cleanup.pad cleanup.pad: ; CHECK: cleanup.pad: - ; CHECK: store i32 1 ; CHECK: invoke void @f(i32 0) %cleanup = cleanuppad within none [] invoke void @f(i32 0) diff --git a/llvm/test/CodeGen/WinEH/wineh-statenumbering.ll b/llvm/test/CodeGen/WinEH/wineh-statenumbering.ll index 4e7c36943a01..c9b89838c0e7 100644 --- a/llvm/test/CodeGen/WinEH/wineh-statenumbering.ll +++ b/llvm/test/CodeGen/WinEH/wineh-statenumbering.ll @@ -120,7 +120,6 @@ try.cont4: ; preds = %try.cont ehcleanup: ; preds = %catch.dispatch1 %4 = cleanuppad within %1 [] ; CHECK: ehcleanup: - ; CHECK: store i32 -1 ; CHECK: call void @dtor() call void @dtor() #3 [ "funclet"(token %4) ] cleanupret from %4 unwind to caller diff --git a/llvm/test/CodeGen/X86/win32-seh-nested-finally.ll b/llvm/test/CodeGen/X86/win32-seh-nested-finally.ll index c283a35d70cf..9db8f996c03e 100644 --- a/llvm/test/CodeGen/X86/win32-seh-nested-finally.ll +++ b/llvm/test/CodeGen/X86/win32-seh-nested-finally.ll @@ -56,7 +56,6 @@ attributes #3 = { noinline } ; CHECK: LBB0_[[inner:[0-9]+]]: # %ehcleanup ; CHECK: pushl %ebp ; CHECK: addl $12, %ebp -; CHECK: movl $0, -[[state]](%ebp) ; CHECK: movl $2, (%esp) ; CHECK: calll _f ; CHECK: popl %ebp @@ -65,7 +64,6 @@ attributes #3 = { noinline } ; CHECK: LBB0_[[outer:[0-9]+]]: # %ehcleanup.3 ; CHECK: pushl %ebp ; CHECK: addl $12, %ebp -; CHECK: movl $-1, -[[state]](%ebp) ; CHECK: movl $3, (%esp) ; CHECK: calll _f ; CHECK: popl %ebp