• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -verify-machineinstrs < %s | FileCheck %s
2; RUN: llc -verify-machineinstrs -O0 < %s | FileCheck %s
3
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  %cs = catchswitch within none [label %__except] unwind to caller
18
19__except:                                         ; preds = %catch.dispatch
20  %pad = catchpad within %cs [i8* null]
21  catchret from %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}
31
32; CHECK-LABEL: ehcode:
33; CHECK: xorl %ecx, %ecx
34; CHECK: callq f
35
36; CHECK: # %__except
37; CHECK: movl %eax, %ecx
38; CHECK-NEXT: callq f
39