• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: sed -e s/.Cxx:// %s | opt -mtriple=x86-pc-windows-msvc -S -x86-winehstate | FileCheck %s
2; RUN: sed -e s/.SEH:// %s | opt -mtriple=x86-pc-windows-msvc -S -x86-winehstate | FileCheck %s
3
4declare i32 @__CxxFrameHandler3(...)
5declare i32 @_except_handler3(...)
6declare void @dummy_filter()
7
8declare void @f(i32)
9
10; CHECK-LABEL: define void @test2(
11;Cxx: define void @test2(i1 %b) personality i32 (...)* @__CxxFrameHandler3 {
12;SEH: define void @test2(i1 %b) personality i32 (...)* @_except_handler3 {
13entry:
14  ; CHECK: entry:
15  ; CHECK:   store i32 1
16  ; CHECK:   invoke void @f(i32 1)
17  invoke void @f(i32 1)
18    to label %exit unwind label %cleanup.pad
19cleanup.pad:
20  %cleanup = cleanuppad within none []
21  br i1 %b, label %left, label %right
22left:
23  cleanupret from %cleanup unwind label %catch.pad
24right:
25  cleanupret from %cleanup unwind label %catch.pad
26catch.pad:
27  %cs1 = catchswitch within none [label %catch.body] unwind to caller
28catch.body:
29;Cxx: %catch = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
30;SEH: %catch = catchpad within %cs1 [void ()* @dummy_filter]
31  catchret from %catch to label %exit
32exit:
33  ret void
34}
35
36; CHECK-LABEL: define void @test3(
37;Cxx: define void @test3() personality i32 (...)* @__CxxFrameHandler3 {
38;SEH: define void @test3() personality i32 (...)* @_except_handler3 {
39entry:
40  ; CHECK: entry:
41  ; CHECK:   store i32 0
42  ; CHECK:   invoke void @f(i32 1)
43  invoke void @f(i32 1)
44    to label %exit unwind label %cleanup.pad
45cleanup.pad:
46  ; CHECK: cleanup.pad:
47  ; CHECK:   invoke void @f(i32 0)
48  %cleanup = cleanuppad within none []
49  invoke void @f(i32 0)
50    to label %unreachable unwind label %catch.pad
51unreachable:
52  unreachable
53catch.pad:
54  %cs1 = catchswitch within none [label %catch.body] unwind to caller
55catch.body:
56;Cxx: %catch = catchpad within %cs1 [i8* null, i32 u0x40, i8* null]
57;SEH: %catch = catchpad within %cs1 [void ()* @dummy_filter]
58  catchret from %catch to label %exit
59exit:
60  ret void
61}
62