[PATCH] D14580: [WinEH] Only generate UnwindHelp slot for MSVCXX
Joseph Tremoulet via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 11 11:14:52 PST 2015
JosephTremoulet created this revision.
JosephTremoulet added reviewers: rnk, majnemer, andrew.w.kaylor.
JosephTremoulet added a subscriber: llvm-commits.
Other personalities don't use this special frame slot.
http://reviews.llvm.org/D14580
Files:
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/seh-catchpad.ll
Index: test/CodeGen/X86/seh-catchpad.ll
===================================================================
--- test/CodeGen/X86/seh-catchpad.ll
+++ test/CodeGen/X86/seh-catchpad.ll
@@ -97,19 +97,19 @@
; CHECK: .seh_handler __C_specific_handler, @unwind, @except
; CHECK: pushq %rbp
; CHECK: .seh_pushreg 5
-; CHECK: subq $48, %rsp
-; CHECK: .seh_stackalloc 48
-; CHECK: leaq 48(%rsp), %rbp
-; CHECK: .seh_setframe 5, 48
+; CHECK: subq $32, %rsp
+; CHECK: .seh_stackalloc 32
+; CHECK: leaq 32(%rsp), %rbp
+; CHECK: .seh_setframe 5, 32
; CHECK: .seh_endprologue
; CHECK: .Ltmp0:
; CHECK: movl $1, %ecx
; CHECK: xorl %edx, %edx
; CHECK: callq do_div
; CHECK: .Ltmp1:
; CHECK: .LBB1_[[epilogue:[0-9]+]]: # %__try.cont.12
; CHECK: xorl %eax, %eax
-; CHECK: addq $48, %rsp
+; CHECK: addq $32, %rsp
; CHECK: popq %rbp
; CHECK: retq
; CHECK: .LBB1_[[except1bb:[0-9]+]]: # %catch.dispatch
@@ -162,7 +162,7 @@
; CHECK: .seh_pushreg 5
; CHECK: subq $32, %rsp
; CHECK: .seh_stackalloc 32
-; CHECK: leaq 48(%rdx), %rbp
+; CHECK: leaq 32(%rdx), %rbp
; CHECK: .seh_endprologue
; CHECK: callq "?fin$0 at 0@main@@"
; CHECK: nop
Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -2878,18 +2878,18 @@
FuncInfo->setArgumentStackSize(StackSize);
- if (MMI.hasWinEHFuncInfo(Fn)) {
- if (Is64Bit) {
- int UnwindHelpFI = MFI->CreateStackObject(8, 8, /*isSS=*/false);
- SDValue StackSlot = DAG.getFrameIndex(UnwindHelpFI, MVT::i64);
- MMI.getWinEHFuncInfo(MF.getFunction()).UnwindHelpFrameIdx = UnwindHelpFI;
- SDValue Neg2 = DAG.getConstant(-2, dl, MVT::i64);
- Chain = DAG.getStore(Chain, dl, Neg2, StackSlot,
- MachinePointerInfo::getFixedStack(
- DAG.getMachineFunction(), UnwindHelpFI),
- /*isVolatile=*/true,
- /*isNonTemporal=*/false, /*Alignment=*/0);
- }
+ if (MMI.hasWinEHFuncInfo(Fn) && Is64Bit &&
+ classifyEHPersonality(Fn->getPersonalityFn()) ==
+ EHPersonality::MSVC_CXX) {
+ int UnwindHelpFI = MFI->CreateStackObject(8, 8, /*isSS=*/false);
+ SDValue StackSlot = DAG.getFrameIndex(UnwindHelpFI, MVT::i64);
+ MMI.getWinEHFuncInfo(MF.getFunction()).UnwindHelpFrameIdx = UnwindHelpFI;
+ SDValue Neg2 = DAG.getConstant(-2, dl, MVT::i64);
+ Chain = DAG.getStore(Chain, dl, Neg2, StackSlot,
+ MachinePointerInfo::getFixedStack(
+ DAG.getMachineFunction(), UnwindHelpFI),
+ /*isVolatile=*/true,
+ /*isNonTemporal=*/false, /*Alignment=*/0);
}
return Chain;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14580.39950.patch
Type: text/x-patch
Size: 3114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151111/e90cbb9d/attachment.bin>
More information about the llvm-commits
mailing list