blob: 52246907874230953f342a4622ddd51f7269e92a [file] [log] [blame]
Reid Kleckner94fe8362015-10-07 23:55:06 +00001; RUN: llc < %s | FileCheck %s
Reid Klecknerebef2562015-10-09 00:15:13 +00002; RUN: llc -O0 < %s | FileCheck %s
Reid Kleckner94fe8362015-10-07 23:55:06 +00003
4target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-pc-windows-msvc"
6
7declare void @f(i32)
8declare i32 @__C_specific_handler(...)
9declare i32 @llvm.eh.exceptioncode(token)
10
11define void @ehcode() personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
12entry:
13 invoke void @f(i32 0)
14 to label %__try.cont unwind label %catch.dispatch
15
16catch.dispatch: ; preds = %entry
17 %pad = catchpad [i8* null]
18 to label %__except unwind label %catchendblock
19
20__except: ; preds = %catch.dispatch
21 catchret %pad to label %__except.1
22
23__except.1: ; preds = %__except
24 %code = call i32 @llvm.eh.exceptioncode(token %pad)
25 call void @f(i32 %code)
26 br label %__try.cont
27
28__try.cont: ; preds = %entry, %__except.1
29 ret void
30
31catchendblock: ; preds = %catch.dispatch
32 catchendpad unwind to caller
33}
34
35; CHECK-LABEL: ehcode:
36; CHECK: xorl %ecx, %ecx
37; CHECK: callq f
Reid Kleckner94fe8362015-10-07 23:55:06 +000038
39; CHECK: # %__except
Reid Klecknerebef2562015-10-09 00:15:13 +000040; CHECK: movl %eax, %ecx
Reid Kleckner94fe8362015-10-07 23:55:06 +000041; CHECK-NEXT: callq f