blob: 465ee1218fda2aca91f7792c12f22f95b6a74893 [file] [log] [blame]
Manman Ren519127f2013-07-15 23:47:29 +00001; RUN: llc < %s -mcpu=cortex-a15 -verify-machineinstrs | FileCheck %s
2
3; Check a spill right after a function call with large struct byval is correctly
4; generated.
5; PR16393
6
7; CHECK: set_stored_macroblock_parameters
8; CHECK: str r{{.*}}, [sp, [[SLOT:#[0-9]+]]] @ 4-byte Spill
9; CHECK: bl RestoreMVBlock8x8
10; CHECK: bl RestoreMVBlock8x8
11; CHECK: bl RestoreMVBlock8x8
12; CHECK: ldr r{{.*}}, [sp, [[SLOT]]] @ 4-byte Reload
13
14target triple = "armv7l-unknown-linux-gnueabihf"
15
Manman Ren1872b582013-07-16 18:26:48 +000016%structA = type { double, [16 x [16 x i16]], [16 x [16 x i16]], [16 x [16 x i16]], i32****, i32***, i32, i16, [4 x i32], [4 x i32], i8**, [16 x i8], [16 x i8], i32, i64, i32, i16******, i16******, [2 x [4 x [4 x i8]]], i32, i32, i32, i32, i32, i32, i32, i32, i32 }
17%structB = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8**, i8**, i32, i32***, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [9 x [16 x [16 x i16]]], [5 x [16 x [16 x i16]]], [9 x [8 x [8 x i16]]], [2 x [4 x [16 x [16 x i16]]]], [16 x [16 x i16]], [16 x [16 x i32]], i32****, i32***, i32***, i32***, i32****, i32****, %structC*, %structD*, %structK*, i32*, i32*, i32, i32, i32, i32, [4 x [4 x i32]], i32, i32, i32, i32, i32, double, i32, i32, i32, i32, i16******, i16******, i16******, i16******, [15 x i16], i32, i32, i32, i32, i32, i32, i32, i32, [6 x [32 x i32]], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [1 x i32], i32, i32, [2 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %structL*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double**, double***, i32***, double**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x [2 x i32]], [2 x i32], i32, i32, i16, i32, i32, i32, i32, i32 }
18%structC = type { i32, i32, [100 x %structD*], i32, float, float, float }
19%structD = type { i32, i32, i32, i32, i32, i32, %structE*, %structH*, %structJ*, i32, i32*, i32*, i32*, i32, i32*, i32*, i32*, i32 (i32)*, [3 x [2 x i32]] }
20%structE = type { %structF*, %structG, %structG }
21%structF = type { i32, i32, i8, i32, i32, i8, i8, i32, i32, i8*, i32 }
22%structG = type { i32, i32, i32, i32, i32, i8*, i32*, i32, i32 }
23%structH = type { [3 x [11 x %structI]], [2 x [9 x %structI]], [2 x [10 x %structI]], [2 x [6 x %structI]], [4 x %structI], [4 x %structI], [3 x %structI] }
24%structI = type { i16, i8, i32 }
25%structJ = type { [2 x %structI], [4 x %structI], [3 x [4 x %structI]], [10 x [4 x %structI]], [10 x [15 x %structI]], [10 x [15 x %structI]], [10 x [5 x %structI]], [10 x [5 x %structI]], [10 x [15 x %structI]], [10 x [15 x %structI]] }
26%structK = type { i32, i32, i32, [2 x i32], i32, [8 x i32], %structK*, %structK*, i32, [2 x [4 x [4 x [2 x i32]]]], [16 x i8], [16 x i8], i32, i64, [4 x i32], [4 x i32], i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, double, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
27%structL = type { i32, i32, i32, i32, i32, %structL* }
28%structM = type { i32, i32, i32, i32, i32, i32, [6 x [33 x i64]], [6 x [33 x i64]], [6 x [33 x i64]], [6 x [33 x i64]], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16**, i16****, i16****, i16*****, i16***, i8*, i8***, i64***, i64***, i16****, i8**, i8**, %structM*, %structM*, %structM*, i32, i32, i32, i32, i32, i32, i32 }
29%structN = type { i32, [16 x [16 x i32]], [16 x [16 x i32]], [16 x [16 x i32]], [3 x [16 x [16 x i32]]], [4 x i16], [4 x i8], [4 x i8], [4 x i8], [16 x [16 x i16]], [16 x [16 x i16]], [16 x [16 x i32]] }
Manman Ren519127f2013-07-15 23:47:29 +000030
31@cofAC = external global i32****, align 4
32@cofDC = external global i32***, align 4
Manman Ren1872b582013-07-16 18:26:48 +000033@rdopt = external global %structA*, align 4
34@img = external global %structB*
35@enc_picture = external global %structM*
Manman Ren519127f2013-07-15 23:47:29 +000036@si_frame_indicator = external global i32, align 4
37@sp2_frame_indicator = external global i32, align 4
38@lrec = external global i32**, align 4
Manman Ren1872b582013-07-16 18:26:48 +000039@tr8x8 = external global %structN, align 4
Manman Ren519127f2013-07-15 23:47:29 +000040@best_mode = external global i16, align 2
41@best_c_imode = external global i32, align 4
42@best_i16offset = external global i32, align 4
43@bi_pred_me = external global i16, align 2
44@b8mode = external global [4 x i32], align 4
45@b8pdir = external global [4 x i32], align 4
46@b4_intra_pred_modes = external global [16 x i8], align 1
47@b8_intra_pred_modes8x8 = external global [16 x i8], align 1
48@b4_ipredmode = external global [16 x i8], align 1
49@b8_ipredmode8x8 = external global [4 x [4 x i8]], align 1
50@rec_mbY = external global [16 x [16 x i16]], align 2
51@lrec_rec = external global [16 x [16 x i32]], align 4
52@rec_mbU = external global [16 x [16 x i16]], align 2
53@rec_mbV = external global [16 x [16 x i16]], align 2
54@lrec_rec_U = external global [16 x [16 x i32]], align 4
55@lrec_uv = external global i32***, align 4
56@lrec_rec_V = external global [16 x [16 x i32]], align 4
57@cbp = external global i32, align 4
58@cbp_blk = external global i64, align 8
59@luma_transform_size_8x8_flag = external global i32, align 4
60@frefframe = external global [4 x [4 x i8]], align 1
61@brefframe = external global [4 x [4 x i8]], align 1
62
63; Function Attrs: nounwind
64declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) #0
65
66; Function Attrs: nounwind
67declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #0
68
69; Function Attrs: nounwind
Manman Ren1872b582013-07-16 18:26:48 +000070declare void @SetMotionVectorsMB(%structK* nocapture, i32) #1
Manman Ren519127f2013-07-15 23:47:29 +000071
72; Function Attrs: nounwind
73define void @set_stored_macroblock_parameters() #1 {
74entry:
Manman Renaef1b372013-09-30 18:17:35 +000075 %0 = load %structB** @img, align 4
76 %1 = load i32* undef, align 4
Manman Ren1872b582013-07-16 18:26:48 +000077 %mb_data = getelementptr inbounds %structB* %0, i32 0, i32 61
Manman Renaef1b372013-09-30 18:17:35 +000078 %2 = load %structK** %mb_data, align 4
Manman Ren519127f2013-07-15 23:47:29 +000079 br label %for.body
80
81for.body: ; preds = %for.body, %entry
82 br i1 undef, label %for.end, label %for.body
83
84for.end: ; preds = %for.body
85 br i1 undef, label %for.body20, label %if.end
86
87for.body20: ; preds = %for.end
88 unreachable
89
90if.end: ; preds = %for.end
91 br i1 undef, label %if.end40, label %for.cond31.preheader
92
93for.cond31.preheader: ; preds = %if.end
94 unreachable
95
96if.end40: ; preds = %if.end
97 br i1 undef, label %if.end43, label %if.then42
98
99if.then42: ; preds = %if.end40
100 br label %if.end43
101
102if.end43: ; preds = %if.then42, %if.end40
103 br i1 undef, label %if.end164, label %for.cond47.preheader
104
105for.cond47.preheader: ; preds = %if.end43
106 br i1 undef, label %for.body119, label %if.end164
107
108for.body119: ; preds = %for.body119, %for.cond47.preheader
109 br i1 undef, label %for.body119, label %if.end164
110
111if.end164: ; preds = %for.body119, %for.cond47.preheader, %if.end43
Manman Renaef1b372013-09-30 18:17:35 +0000112 store i32*** null, i32**** @cofDC, align 4
Manman Ren1872b582013-07-16 18:26:48 +0000113 %mb_type = getelementptr inbounds %structK* %2, i32 %1, i32 8
Manman Ren519127f2013-07-15 23:47:29 +0000114 br i1 undef, label %if.end230, label %if.then169
115
116if.then169: ; preds = %if.end164
117 br i1 undef, label %for.cond185.preheader, label %for.cond210.preheader
118
119for.cond185.preheader: ; preds = %if.then169
120 unreachable
121
122for.cond210.preheader: ; preds = %if.then169
123 unreachable
124
125if.end230: ; preds = %if.end164
126 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* undef, i8* bitcast ([4 x i32]* @b8mode to i8*), i32 16, i32 4, i1 false)
Manman Ren1872b582013-07-16 18:26:48 +0000127 %b8pdir = getelementptr inbounds %structK* %2, i32 %1, i32 15
Manman Ren519127f2013-07-15 23:47:29 +0000128 %3 = bitcast [4 x i32]* %b8pdir to i8*
129 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %3, i8* bitcast ([4 x i32]* @b8pdir to i8*), i32 16, i32 4, i1 false)
130 br i1 undef, label %if.end236, label %if.then233
131
132if.then233: ; preds = %if.end230
133 unreachable
134
135if.end236: ; preds = %if.end230
136 %cmp242 = icmp ne i16 undef, 8
Manman Renaef1b372013-09-30 18:17:35 +0000137 %4 = load i32* @luma_transform_size_8x8_flag, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000138 %tobool245 = icmp ne i32 %4, 0
139 %or.cond812 = or i1 %cmp242, %tobool245
140 br i1 %or.cond812, label %if.end249, label %land.lhs.true246
141
142land.lhs.true246: ; preds = %if.end236
143 br i1 undef, label %if.end249, label %if.then248
144
145if.then248: ; preds = %land.lhs.true246
Andrew Trick6ea2b962013-07-25 18:35:14 +0000146 tail call void asm sideeffect "", "~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11}"() nounwind
Manman Ren1872b582013-07-16 18:26:48 +0000147 tail call void @RestoreMVBlock8x8(i32 1, i32 0, %structN* byval @tr8x8, i32 0) #0
148 tail call void @RestoreMVBlock8x8(i32 1, i32 2, %structN* byval @tr8x8, i32 0) #0
149 tail call void @RestoreMVBlock8x8(i32 1, i32 3, %structN* byval @tr8x8, i32 0) #0
Manman Ren519127f2013-07-15 23:47:29 +0000150 br label %if.end249
151
152if.end249: ; preds = %if.then248, %land.lhs.true246, %if.end236
Manman Renaef1b372013-09-30 18:17:35 +0000153 %5 = load i32* @luma_transform_size_8x8_flag, align 4
154 %6 = load %structA** @rdopt, align 4
Manman Ren1872b582013-07-16 18:26:48 +0000155 %luma_transform_size_8x8_flag264 = getelementptr inbounds %structA* %6, i32 0, i32 21
Manman Renaef1b372013-09-30 18:17:35 +0000156 store i32 %5, i32* %luma_transform_size_8x8_flag264, align 4
157 %7 = load i32* undef, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000158 %add281 = add nsw i32 %7, 0
159 br label %for.body285
160
161for.body285: ; preds = %for.inc503, %if.end249
Manman Ren1872b582013-07-16 18:26:48 +0000162 %8 = phi %structB* [ undef, %if.end249 ], [ %.pre1155, %for.inc503 ]
Manman Ren519127f2013-07-15 23:47:29 +0000163 %i.21103 = phi i32 [ 0, %if.end249 ], [ %inc504, %for.inc503 ]
Manman Ren1872b582013-07-16 18:26:48 +0000164 %block_x286 = getelementptr inbounds %structB* %8, i32 0, i32 37
Manman Renaef1b372013-09-30 18:17:35 +0000165 %9 = load i32* %block_x286, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000166 %add287 = add nsw i32 %9, %i.21103
167 %shr289 = ashr i32 %i.21103, 1
168 %add290 = add nsw i32 %shr289, 0
Manman Ren1872b582013-07-16 18:26:48 +0000169 %arrayidx292 = getelementptr inbounds %structK* %2, i32 %1, i32 15, i32 %add290
Manman Renaef1b372013-09-30 18:17:35 +0000170 %10 = load %structM** @enc_picture, align 4
Manman Ren1872b582013-07-16 18:26:48 +0000171 %ref_idx = getelementptr inbounds %structM* %10, i32 0, i32 35
Manman Renaef1b372013-09-30 18:17:35 +0000172 %11 = load i8**** %ref_idx, align 4
173 %12 = load i8*** %11, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000174 %arrayidx313 = getelementptr inbounds i8** %12, i32 %add281
Manman Renaef1b372013-09-30 18:17:35 +0000175 %13 = load i8** %arrayidx313, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000176 %arrayidx314 = getelementptr inbounds i8* %13, i32 %add287
Manman Renaef1b372013-09-30 18:17:35 +0000177 store i8 -1, i8* %arrayidx314, align 1
178 %14 = load %structB** @img, align 4
Manman Ren1872b582013-07-16 18:26:48 +0000179 %MbaffFrameFlag327 = getelementptr inbounds %structB* %14, i32 0, i32 100
Manman Renaef1b372013-09-30 18:17:35 +0000180 %15 = load i32* %MbaffFrameFlag327, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000181 %tobool328 = icmp eq i32 %15, 0
182 br i1 %tobool328, label %if.end454, label %if.then329
183
184if.then329: ; preds = %for.body285
Manman Renaef1b372013-09-30 18:17:35 +0000185 %16 = load %structA** @rdopt, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000186 br label %if.end454
187
188if.end454: ; preds = %if.then329, %for.body285
Manman Renaef1b372013-09-30 18:17:35 +0000189 %17 = load i32* %arrayidx292, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000190 %cmp457 = icmp eq i32 %17, 0
191 br i1 %cmp457, label %if.then475, label %lor.lhs.false459
192
193lor.lhs.false459: ; preds = %if.end454
Manman Renaef1b372013-09-30 18:17:35 +0000194 %18 = load i32* %mb_type, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000195 switch i32 %18, label %for.inc503 [
196 i32 9, label %if.then475
197 i32 10, label %if.then475
198 i32 13, label %if.then475
199 i32 14, label %if.then475
200 ]
201
202if.then475: ; preds = %lor.lhs.false459, %lor.lhs.false459, %lor.lhs.false459, %lor.lhs.false459, %if.end454
Manman Renaef1b372013-09-30 18:17:35 +0000203 store i16 0, i16* undef, align 2
Manman Ren519127f2013-07-15 23:47:29 +0000204 br label %for.inc503
205
206for.inc503: ; preds = %if.then475, %lor.lhs.false459
207 %inc504 = add nsw i32 %i.21103, 1
Manman Renaef1b372013-09-30 18:17:35 +0000208 %.pre1155 = load %structB** @img, align 4
Manman Ren519127f2013-07-15 23:47:29 +0000209 br label %for.body285
210}
211
212; Function Attrs: nounwind
213declare void @update_offset_params(i32, i32) #1
214
215; Function Attrs: nounwind
Manman Ren1872b582013-07-16 18:26:48 +0000216declare void @RestoreMVBlock8x8(i32, i32, %structN* byval nocapture, i32) #1
Manman Ren519127f2013-07-15 23:47:29 +0000217
218attributes #0 = { nounwind }
Bill Wendlingcec45be2013-08-22 21:20:14 +0000219attributes #1 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }