[WinEH] Don't perform state stores in cleanups

Our cleanups do not support true lexical nesting of funclets which
obviates the need to perform state stores.

This fixes PR26361.

llvm-svn: 259161
This commit is contained in:
David Majnemer 2016-01-29 05:33:15 +00:00
parent 4661c610be
commit f2bb710da5
4 changed files with 4 additions and 4 deletions

View File

@ -425,6 +425,10 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) {
BasicBlock *FuncletEntryBB = BBColors.front();
if (auto *FuncletPad =
dyn_cast<FuncletPadInst>(FuncletEntryBB->getFirstNonPHI())) {
// We do not support nesting funclets within cleanuppads.
if (isa<CleanupPadInst>(FuncletPad))
continue;
auto BaseStateI = FuncInfo.FuncletBaseStateMap.find(FuncletPad);
if (BaseStateI != FuncInfo.FuncletBaseStateMap.end())
BaseState = BaseStateI->second;

View File

@ -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)

View File

@ -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

View File

@ -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