Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit d16f119

Browse files
majnemeralexcrichton
authored andcommitted
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259161 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 9cc2b72 commit d16f119

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

lib/Target/X86/X86WinEHState.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) {
425425
BasicBlock *FuncletEntryBB = BBColors.front();
426426
if (auto *FuncletPad =
427427
dyn_cast<FuncletPadInst>(FuncletEntryBB->getFirstNonPHI())) {
428+
// We do not support nesting funclets within cleanuppads.
429+
if (isa<CleanupPadInst>(FuncletPad))
430+
continue;
431+
428432
auto BaseStateI = FuncInfo.FuncletBaseStateMap.find(FuncletPad);
429433
if (BaseStateI != FuncInfo.FuncletBaseStateMap.end())
430434
BaseState = BaseStateI->second;

test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ entry:
4444
to label %exit unwind label %cleanup.pad
4545
cleanup.pad:
4646
; CHECK: cleanup.pad:
47-
; CHECK: store i32 1
4847
; CHECK: invoke void @f(i32 0)
4948
%cleanup = cleanuppad within none []
5049
invoke void @f(i32 0)

test/CodeGen/WinEH/wineh-statenumbering.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ try.cont4: ; preds = %try.cont
120120
ehcleanup: ; preds = %catch.dispatch1
121121
%4 = cleanuppad within %1 []
122122
; CHECK: ehcleanup:
123-
; CHECK: store i32 -1
124123
; CHECK: call void @dtor()
125124
call void @dtor() #3 [ "funclet"(token %4) ]
126125
cleanupret from %4 unwind to caller

test/CodeGen/X86/win32-seh-nested-finally.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ attributes #3 = { noinline }
5656
; CHECK: LBB0_[[inner:[0-9]+]]: # %ehcleanup
5757
; CHECK: pushl %ebp
5858
; CHECK: addl $12, %ebp
59-
; CHECK: movl $0, -[[state]](%ebp)
6059
; CHECK: movl $2, (%esp)
6160
; CHECK: calll _f
6261
; CHECK: popl %ebp
@@ -65,7 +64,6 @@ attributes #3 = { noinline }
6564
; CHECK: LBB0_[[outer:[0-9]+]]: # %ehcleanup.3
6665
; CHECK: pushl %ebp
6766
; CHECK: addl $12, %ebp
68-
; CHECK: movl $-1, -[[state]](%ebp)
6967
; CHECK: movl $3, (%esp)
7068
; CHECK: calll _f
7169
; CHECK: popl %ebp

0 commit comments

Comments
 (0)