Skip to content

Commit 33c352b

Browse files
committed
Merging r247435:
------------------------------------------------------------------------ r247435 | david.majnemer | 2015-09-11 13:34:34 -0400 (Fri, 11 Sep 2015) | 8 lines [X86] Make sure startproc/endproc are paired We used different conditions to determine if we should emit startproc vs endproc. Use the same condition to ensure that they will always be paired. This fixes PR24374. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_37@253742 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 3f4c496 commit 33c352b

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

lib/CodeGen/AsmPrinter/WinException.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void WinException::endFunction(const MachineFunction *MF) {
169169
Asm->OutStreamer->PopSection();
170170
}
171171

172-
if (shouldEmitMoves)
172+
if (shouldEmitMoves || shouldEmitPersonality)
173173
Asm->OutStreamer->EmitWinCFIEndProc();
174174
}
175175

test/CodeGen/X86/pr24374.ll

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
; RUN: llc < %s | FileCheck %s
2+
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3+
target triple = "x86_64-w64-windows-gnu"
4+
5+
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @g, i8* null }]
6+
7+
declare i32 @__gxx_personality_seh0(...)
8+
9+
; Function Attrs: nounwind
10+
define void @f() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_seh0 to i8*) {
11+
entry:
12+
invoke void @g()
13+
to label %exit unwind label %lpad
14+
15+
lpad: ; preds = %entry
16+
landingpad { i8*, i32 }
17+
cleanup
18+
unreachable
19+
20+
exit: ; preds = %entry
21+
unreachable
22+
}
23+
; CHECK-LABEL: f:
24+
; CHECK: .seh_proc f
25+
; CHECK: .seh_handler __gxx_personality_seh0, @unwind, @except
26+
; CHECK: callq g
27+
; CHECK: .seh_handlerdata
28+
; CHECK: .seh_endproc
29+
30+
define void @g() {
31+
unreachable
32+
}
33+
; CHECK-LABEL: g:
34+
; CHECK: .seh_proc g
35+
; CHECK: .seh_endproc
36+
37+
attributes #0 = { nounwind }

0 commit comments

Comments
 (0)