• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s | FileCheck %s
2target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-pc-windows-msvc"
4
5define void @test1(i64* %result.repack) personality i32 (...)* @__CxxFrameHandler3 {
6bb:
7  invoke void @may_throw(i32 1)
8          to label %postinvoke unwind label %cleanuppad
9; CHECK:        movl    $1, %ecx
10; CHECK:        callq   may_throw
11
12postinvoke:                                       ; preds = %bb
13  store i64 19, i64* %result.repack, align 8
14
15; CHECK:        movq    $19, (%rsi)
16; CHECK:        movl    $2, %ecx
17; CHECK-NEXT:   movq    %rsi, -8(%rbp)
18; CHECK-NEXT:   callq   may_throw
19  invoke void @may_throw(i32 2)
20          to label %assertFailed unwind label %catch.dispatch
21
22catch.dispatch:                                   ; preds = %cleanuppad9, %postinvoke
23  %tmp3 = catchswitch within none [label %catch.object.Throwable] unwind label %cleanuppad
24
25catch.object.Throwable:                           ; preds = %catch.dispatch
26  %tmp2 = catchpad within %tmp3 [i8* null, i32 64, i8* null]
27  catchret from %tmp2 to label %catchhandler
28
29catchhandler:                                     ; preds = %catch.object.Throwable
30  invoke void @may_throw(i32 3)
31          to label %try.success.or.caught unwind label %cleanuppad
32
33try.success.or.caught:                            ; preds = %catchhandler
34  invoke void @may_throw(i32 4)
35          to label %postinvoke27 unwind label %cleanuppad24
36; CHECK:        movl    $4, %ecx
37; CHECK-NEXT:   callq   may_throw
38
39postinvoke27:                                     ; preds = %try.success.or.caught
40  store i64 42, i64* %result.repack, align 8
41; CHECK:        movq    -8(%rbp), %[[reload:r..]]
42; CHECK-NEXT:   movq    $42, (%[[reload]])
43  ret void
44
45cleanuppad24:                                     ; preds = %try.success.or.caught
46  %tmp5 = cleanuppad within none []
47  cleanupret from %tmp5 unwind to caller
48
49cleanuppad:                                       ; preds = %catchhandler, %catch.dispatch, %bb
50  %tmp1 = cleanuppad within none []
51  cleanupret from %tmp1 unwind to caller
52
53assertFailed:                                     ; preds = %postinvoke
54  invoke void @may_throw(i32 5)
55          to label %postinvoke13 unwind label %cleanuppad9
56
57postinvoke13:                                     ; preds = %assertFailed
58  unreachable
59
60cleanuppad9:                                      ; preds = %assertFailed
61  %tmp4 = cleanuppad within none []
62  cleanupret from %tmp4 unwind label %catch.dispatch
63}
64
65declare void @may_throw(i32)
66
67declare i32 @__CxxFrameHandler3(...)
68