Move the personality function from LandingPadInst to Function
[oota-llvm.git] / test / Transforms / LoopUnswitch / 2012-04-30-LoopUnswitch-LPad-Crash.ll
1 ; RUN: opt < %s -basicaa -instcombine -inline -functionattrs -licm -loop-unswitch -gvn -verify
2 ; PR12573
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx10.7.0"
5
6 %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379 = type { %class.C.23.43.67.103.139.159.179.199.239.243.247.251.263.295.303.339.347.376*, %class.B.21.41.65.101.137.157.177.197.237.241.245.249.261.293.301.337.345.378 }
7 %class.C.23.43.67.103.139.159.179.199.239.243.247.251.263.295.303.339.347.376 = type { %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379* }
8 %class.B.21.41.65.101.137.157.177.197.237.241.245.249.261.293.301.337.345.378 = type { %class.A.20.40.64.100.136.156.176.196.236.240.244.248.260.292.300.336.344.377* }
9 %class.A.20.40.64.100.136.156.176.196.236.240.244.248.260.292.300.336.344.377 = type { i8 }
10
11 define void @_Z23get_reconstruction_pathv() uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
12 entry:
13   %c = alloca %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379, align 8
14   br label %for.cond
15
16 for.cond:                                         ; preds = %for.end, %entry
17   invoke void @_ZN1DptEv(%class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379* %c)
18           to label %invoke.cont unwind label %lpad
19
20 invoke.cont:                                      ; preds = %for.cond
21   invoke void @_ZN1C3endEv()
22           to label %for.cond3 unwind label %lpad
23
24 for.cond3:                                        ; preds = %invoke.cont6, %invoke.cont
25   invoke void @_ZN1DptEv(%class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379* %c)
26           to label %invoke.cont4 unwind label %lpad
27
28 invoke.cont4:                                     ; preds = %for.cond3
29   invoke void @_ZN1C3endEv()
30           to label %invoke.cont6 unwind label %lpad
31
32 invoke.cont6:                                     ; preds = %invoke.cont4
33   br i1 undef, label %for.cond3, label %for.end
34
35 lpad:                                             ; preds = %for.end, %invoke.cont4, %for.cond3, %invoke.cont, %for.cond
36   %0 = landingpad { i8*, i32 }
37           cleanup
38   resume { i8*, i32 } undef
39
40 for.end:                                          ; preds = %invoke.cont6
41   invoke void @_ZN1C13_M_insert_auxER1D()
42           to label %for.cond unwind label %lpad
43 }
44
45 define void @_ZN1DptEv(%class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379* %this) uwtable ssp align 2 {
46 entry:
47   %this.addr = alloca %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379*, align 8
48   store %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379* %this, %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379** %this.addr, align 8
49   %this1 = load %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379*, %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379** %this.addr
50   %px = getelementptr inbounds %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379, %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379* %this1, i32 0, i32 0
51   %0 = load %class.C.23.43.67.103.139.159.179.199.239.243.247.251.263.295.303.339.347.376*, %class.C.23.43.67.103.139.159.179.199.239.243.247.251.263.295.303.339.347.376** %px, align 8
52   %tobool = icmp ne %class.C.23.43.67.103.139.159.179.199.239.243.247.251.263.295.303.339.347.376* %0, null
53   br i1 %tobool, label %cond.end, label %cond.false
54
55 cond.false:                                       ; preds = %entry
56   call void @_Z10__assert13v() noreturn
57   unreachable
58
59 cond.end:                                         ; preds = %entry
60   ret void
61 }
62
63 declare i32 @__gxx_personality_v0(...)
64
65 declare void @_ZN1C3endEv()
66
67 define void @_ZN1C13_M_insert_auxER1D() uwtable ssp align 2 {
68 entry:
69   ret void
70 }
71
72 define void @_ZN1DD1Ev() unnamed_addr uwtable inlinehint ssp align 2 {
73 entry:
74   ret void
75 }
76
77 define void @_ZN1DD2Ev() unnamed_addr uwtable inlinehint ssp align 2 {
78 entry:
79   ret void
80 }
81
82 define void @_ZN1BD1Ev() unnamed_addr uwtable ssp align 2 {
83 entry:
84   ret void
85 }
86
87 define void @_ZN1BD2Ev() unnamed_addr uwtable ssp align 2 {
88 entry:
89   ret void
90 }
91
92 define void @_ZN1BaSERS_() uwtable ssp align 2 {
93 entry:
94   unreachable
95 }
96
97 declare void @_Z10__assert13v() noreturn