1; RUN: opt -O2 -S < %s | FileCheck %s
2
3target 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"
4target triple = "x86_64-apple-darwin11.1"
5
6%"struct.boost::compressed_pair<empty_t,int>" = type { %"struct.boost::details::compressed_pair_imp<empty_t,int,1>" }
7%"struct.boost::details::compressed_pair_imp<empty_t,int,1>" = type { i32 }
8%struct.empty_base_t = type <{ i8 }>
9%struct.empty_t = type <{ i8 }>
10
11@.str = private constant [25 x i8] c"x.second() was clobbered\00", align 1 ; <[25 x i8]*> [#uses=1]
12
13define i32 @main(i32 %argc, i8** %argv) ssp {
14entry:
15  %argc_addr = alloca i32, align 4                ; <i32*> [#uses=1]
16  %argv_addr = alloca i8**, align 8               ; <i8***> [#uses=1]
17  %retval = alloca i32                            ; <i32*> [#uses=2]
18  %0 = alloca i32                                 ; <i32*> [#uses=2]
19  %retval.1 = alloca i8                           ; <i8*> [#uses=2]
20  %1 = alloca %struct.empty_base_t                ; <%struct.empty_base_t*> [#uses=1]
21  %2 = alloca %struct.empty_base_t*               ; <%struct.empty_base_t**> [#uses=1]
22  %x = alloca %"struct.boost::compressed_pair<empty_t,int>" ; <%"struct.boost::compressed_pair<empty_t,int>"*> [#uses=3]
23  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
24  store i32 %argc, i32* %argc_addr
25  store i8** %argv, i8*** %argv_addr
26  %3 = call i32* @_ZN5boost15compressed_pairI7empty_tiE6secondEv(%"struct.boost::compressed_pair<empty_t,int>"* %x) ssp ; <i32*> [#uses=1]
27  store i32 -3, i32* %3, align 4
28  %4 = call %struct.empty_base_t* @_ZN5boost15compressed_pairI7empty_tiE5firstEv(%"struct.boost::compressed_pair<empty_t,int>"* %x) ssp ; <%struct.empty_base_t*> [#uses=1]
29  store %struct.empty_base_t* %4, %struct.empty_base_t** %2, align 8
30  call void @_ZN7empty_tC1Ev(%struct.empty_base_t* %1) nounwind
31  %5 = call i32* @_ZN5boost15compressed_pairI7empty_tiE6secondEv(%"struct.boost::compressed_pair<empty_t,int>"* %x) ssp ; <i32*> [#uses=1]
32  %6 = load i32, i32* %5, align 4                      ; <i32> [#uses=1]
33  %7 = icmp ne i32 %6, -3                         ; <i1> [#uses=1]
34  %8 = zext i1 %7 to i8                           ; <i8> [#uses=1]
35  store i8 %8, i8* %retval.1, align 1
36  %9 = load i8, i8* %retval.1, align 1                ; <i8> [#uses=1]
37  %toBool = icmp ne i8 %9, 0                      ; <i1> [#uses=1]
38  br i1 %toBool, label %bb, label %bb1
39
40bb:                                               ; preds = %entry
41  %10 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0)) ; <i32> [#uses=0]
42  call void @abort() noreturn
43  unreachable
44
45bb1:                                              ; preds = %entry
46  store i32 0, i32* %0, align 4
47  %11 = load i32, i32* %0, align 4                     ; <i32> [#uses=1]
48  store i32 %11, i32* %retval, align 4
49  br label %return
50
51; CHECK-NOT: x.second() was clobbered
52; CHECK: ret i32
53return:                                           ; preds = %bb1
54  %retval2 = load i32, i32* %retval                    ; <i32> [#uses=1]
55  ret i32 %retval2
56}
57
58define linkonce_odr void @_ZN12empty_base_tC2Ev(%struct.empty_base_t* %this) nounwind ssp align 2 {
59entry:
60  %this_addr = alloca %struct.empty_base_t*, align 8 ; <%struct.empty_base_t**> [#uses=1]
61  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
62  store %struct.empty_base_t* %this, %struct.empty_base_t** %this_addr
63  br label %return
64
65return:                                           ; preds = %entry
66  ret void
67}
68
69define linkonce_odr void @_ZN7empty_tC1Ev(%struct.empty_base_t* %this) nounwind ssp align 2 {
70entry:
71  %this_addr = alloca %struct.empty_base_t*, align 8 ; <%struct.empty_base_t**> [#uses=2]
72  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
73  store %struct.empty_base_t* %this, %struct.empty_base_t** %this_addr
74  %0 = load %struct.empty_base_t*, %struct.empty_base_t** %this_addr, align 8 ; <%struct.empty_base_t*> [#uses=1]
75  call void @_ZN12empty_base_tC2Ev(%struct.empty_base_t* %0) nounwind
76  br label %return
77
78return:                                           ; preds = %entry
79  ret void
80}
81
82define linkonce_odr i32* @_ZN5boost7details19compressed_pair_impI7empty_tiLi1EE6secondEv(%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"* %this) nounwind ssp align 2 {
83entry:
84  %this_addr = alloca %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"*, align 8 ; <%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"**> [#uses=2]
85  %retval = alloca i32*                           ; <i32**> [#uses=2]
86  %0 = alloca i32*                                ; <i32**> [#uses=2]
87  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
88  store %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"* %this, %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"** %this_addr
89  %1 = load %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"*, %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"** %this_addr, align 8 ; <%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"*> [#uses=1]
90  %2 = getelementptr inbounds %"struct.boost::details::compressed_pair_imp<empty_t,int,1>", %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"* %1, i32 0, i32 0 ; <i32*> [#uses=1]
91  store i32* %2, i32** %0, align 8
92  %3 = load i32*, i32** %0, align 8                     ; <i32*> [#uses=1]
93  store i32* %3, i32** %retval, align 8
94  br label %return
95
96return:                                           ; preds = %entry
97  %retval1 = load i32*, i32** %retval                   ; <i32*> [#uses=1]
98  ret i32* %retval1
99}
100
101define linkonce_odr i32* @_ZN5boost15compressed_pairI7empty_tiE6secondEv(%"struct.boost::compressed_pair<empty_t,int>"* %this) ssp align 2 {
102entry:
103  %this_addr = alloca %"struct.boost::compressed_pair<empty_t,int>"*, align 8 ; <%"struct.boost::compressed_pair<empty_t,int>"**> [#uses=2]
104  %retval = alloca i32*                           ; <i32**> [#uses=2]
105  %0 = alloca i32*                                ; <i32**> [#uses=2]
106  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
107  store %"struct.boost::compressed_pair<empty_t,int>"* %this, %"struct.boost::compressed_pair<empty_t,int>"** %this_addr
108  %1 = load %"struct.boost::compressed_pair<empty_t,int>"*, %"struct.boost::compressed_pair<empty_t,int>"** %this_addr, align 8 ; <%"struct.boost::compressed_pair<empty_t,int>"*> [#uses=1]
109  %2 = getelementptr inbounds %"struct.boost::compressed_pair<empty_t,int>", %"struct.boost::compressed_pair<empty_t,int>"* %1, i32 0, i32 0 ; <%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"*> [#uses=1]
110  %3 = call i32* @_ZN5boost7details19compressed_pair_impI7empty_tiLi1EE6secondEv(%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"* %2) nounwind ; <i32*> [#uses=1]
111  store i32* %3, i32** %0, align 8
112  %4 = load i32*, i32** %0, align 8                     ; <i32*> [#uses=1]
113  store i32* %4, i32** %retval, align 8
114  br label %return
115
116return:                                           ; preds = %entry
117  %retval1 = load i32*, i32** %retval                   ; <i32*> [#uses=1]
118  ret i32* %retval1
119}
120
121define linkonce_odr %struct.empty_base_t* @_ZN5boost7details19compressed_pair_impI7empty_tiLi1EE5firstEv(%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"* %this) nounwind ssp align 2 {
122entry:
123  %this_addr = alloca %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"*, align 8 ; <%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"**> [#uses=2]
124  %retval = alloca %struct.empty_base_t*          ; <%struct.empty_base_t**> [#uses=2]
125  %0 = alloca %struct.empty_base_t*               ; <%struct.empty_base_t**> [#uses=2]
126  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
127  store %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"* %this, %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"** %this_addr
128  %1 = load %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"*, %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"** %this_addr, align 8 ; <%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"*> [#uses=1]
129  %2 = bitcast %"struct.boost::details::compressed_pair_imp<empty_t,int,1>"* %1 to %struct.empty_base_t* ; <%struct.empty_base_t*> [#uses=1]
130  store %struct.empty_base_t* %2, %struct.empty_base_t** %0, align 8
131  %3 = load %struct.empty_base_t*, %struct.empty_base_t** %0, align 8    ; <%struct.empty_base_t*> [#uses=1]
132  store %struct.empty_base_t* %3, %struct.empty_base_t** %retval, align 8
133  br label %return
134
135return:                                           ; preds = %entry
136  %retval1 = load %struct.empty_base_t*, %struct.empty_base_t** %retval  ; <%struct.empty_base_t*> [#uses=1]
137  ret %struct.empty_base_t* %retval1
138}
139
140define linkonce_odr %struct.empty_base_t* @_ZN5boost15compressed_pairI7empty_tiE5firstEv(%"struct.boost::compressed_pair<empty_t,int>"* %this) ssp align 2 {
141entry:
142  %this_addr = alloca %"struct.boost::compressed_pair<empty_t,int>"*, align 8 ; <%"struct.boost::compressed_pair<empty_t,int>"**> [#uses=2]
143  %retval = alloca %struct.empty_base_t*          ; <%struct.empty_base_t**> [#uses=2]
144  %0 = alloca %struct.empty_base_t*               ; <%struct.empty_base_t**> [#uses=2]
145  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
146  store %"struct.boost::compressed_pair<empty_t,int>"* %this, %"struct.boost::compressed_pair<empty_t,int>"** %this_addr
147  %1 = load %"struct.boost::compressed_pair<empty_t,int>"*, %"struct.boost::compressed_pair<empty_t,int>"** %this_addr, align 8 ; <%"struct.boost::compressed_pair<empty_t,int>"*> [#uses=1]
148  %2 = getelementptr inbounds %"struct.boost::compressed_pair<empty_t,int>", %"struct.boost::compressed_pair<empty_t,int>"* %1, i32 0, i32 0 ; <%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"*> [#uses=1]
149  %3 = call %struct.empty_base_t* @_ZN5boost7details19compressed_pair_impI7empty_tiLi1EE5firstEv(%"struct.boost::details::compressed_pair_imp<empty_t,int,1>"* %2) nounwind ; <%struct.empty_base_t*> [#uses=1]
150  store %struct.empty_base_t* %3, %struct.empty_base_t** %0, align 8
151  %4 = load %struct.empty_base_t*, %struct.empty_base_t** %0, align 8    ; <%struct.empty_base_t*> [#uses=1]
152  store %struct.empty_base_t* %4, %struct.empty_base_t** %retval, align 8
153  br label %return
154
155return:                                           ; preds = %entry
156  %retval1 = load %struct.empty_base_t*, %struct.empty_base_t** %retval  ; <%struct.empty_base_t*> [#uses=1]
157  ret %struct.empty_base_t* %retval1
158}
159
160declare i32 @puts(i8*)
161
162declare void @abort() noreturn
163