This repository was archived by the owner on Feb 5, 2019. It is now read-only.
File tree 4 files changed +37
-2
lines changed
4 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ void WinException::beginFunction(const MachineFunction *MF) {
68
68
69
69
const Function *F = MF->getFunction ();
70
70
71
- shouldEmitMoves = Asm->needsSEHMoves ();
71
+ shouldEmitMoves = Asm->needsSEHMoves () && MF-> hasWinCFI () ;
72
72
73
73
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering ();
74
74
unsigned PerEncoding = TLOF.getPersonalityEncoding ();
@@ -94,7 +94,7 @@ void WinException::beginFunction(const MachineFunction *MF) {
94
94
95
95
// If we're not using CFI, we don't want the CFI or the personality, but we
96
96
// might want EH tables if we had EH pads.
97
- if (!Asm->MAI ->usesWindowsCFI () || (!MF-> hasWinCFI () && !PerFn) ) {
97
+ if (!Asm->MAI ->usesWindowsCFI ()) {
98
98
if (Per == EHPersonality::MSVC_X86SEH && !hasEHFunclets) {
99
99
// If this is 32-bit SEH and we don't have any funclets (really invokes),
100
100
// make sure we emit the parent offset label. Some unreferenced filter
Original file line number Diff line number Diff line change @@ -2952,6 +2952,10 @@ unsigned X86FrameLowering::getWinEHParentFrameOffset(const MachineFunction &MF)
2952
2952
2953
2953
void X86FrameLowering::processFunctionBeforeFrameFinalized (
2954
2954
MachineFunction &MF, RegScavenger *RS) const {
2955
+ // Mark the function as not having WinCFI. We will set it back to true in
2956
+ // emitPrologue if it gets called and emits CFI.
2957
+ MF.setHasWinCFI (false );
2958
+
2955
2959
// If this function isn't doing Win64-style C++ EH, we don't need to do
2956
2960
// anything.
2957
2961
const Function *Fn = MF.getFunction ();
Original file line number Diff line number Diff line change @@ -29,3 +29,12 @@ entry:
29
29
; and no unwind info in the object file.
30
30
; READOBJ-NOT: leaf_func
31
31
}
32
+
33
+ define void @naked_func () naked {
34
+ call void asm sideeffect "ret" , "" ()
35
+ unreachable
36
+ }
37
+ ; ASM-LABEL: naked_func:
38
+ ; ASM-NOT: .seh_
39
+ ; ASM: ret
40
+ ; ASM-NOT: .seh_
Original file line number Diff line number Diff line change
1
+ ; RUN: llc < %s -O1 -mtriple=x86_64-pc-win32 | FileCheck %s
2
+
3
+ ; Neither of these functions need .seh_ directives. We used to crash.
4
+
5
+ target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
6
+ target triple = "x86_64-pc-windows-msvc"
7
+
8
+ declare i32 @__CxxFrameHandler3 (...)
9
+
10
+ define void @f1 () uwtable nounwind personality i32 (...)* @__CxxFrameHandler3 {
11
+ ret void
12
+ }
13
+
14
+ ; CHECK-LABEL: f1:
15
+ ; CHECK-NOT: .seh_
16
+
17
+ define void @f2 () uwtable {
18
+ ret void
19
+ }
20
+
21
+ ; CHECK-LABEL: f2:
22
+ ; CHECK-NOT: .seh_
You can’t perform that action at this time.
0 commit comments