[safestack] Fix handling of array allocas.
[oota-llvm.git] / test / Transforms / Inline / PR25155.ll
1 ; RUN: opt < %s -inline -S | FileCheck %s
2 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-pc-windows-msvc18.0.0"
4
5 define void @f() personality i32 (...)* @__CxxFrameHandler3 {
6 entry:
7   invoke void @g()
8           to label %try.cont unwind label %catch.dispatch
9
10 catch.dispatch:                                   ; preds = %entry
11   %0 = catchpad [i8* null, i32 64, i8* null]
12           to label %catch unwind label %catchendblock
13
14 catch:                                            ; preds = %catch.dispatch
15   invoke void @dtor()
16           to label %invoke.cont.1 unwind label %catchendblock
17
18 invoke.cont.1:                                    ; preds = %catch
19   catchret %0 to label %try.cont
20
21 try.cont:                                         ; preds = %entry, %invoke.cont.1
22   ret void
23
24 catchendblock:                                    ; preds = %catch, %catch.dispatch
25   catchendpad unwind to caller
26 }
27
28 ; CHECK-LABEL:  define void @f(
29
30 ; CHECK:         invoke void @g()
31 ; CHECK:                 to label %dtor.exit unwind label %terminate.i
32
33 ; CHECK:       terminate.i:
34 ; CHECK-NEXT:    terminatepad [void ()* @terminate] unwind label %catchendblock
35
36 ; CHECK:       catchendblock:
37 ; CHECK-NEXT:    catchendpad unwind to caller
38
39 declare i32 @__CxxFrameHandler3(...)
40
41 define internal void @dtor() personality i32 (...)* @__CxxFrameHandler3 {
42 entry:
43   invoke void @g()
44           to label %invoke.cont unwind label %terminate
45
46 invoke.cont:                                      ; preds = %entry
47   ret void
48
49 terminate:                                        ; preds = %entry
50   terminatepad [void ()* @terminate] unwind to caller
51 }
52
53 declare void @g()
54 declare void @terminate()