1; RUN: llc < %s -disable-fp-elim -march=arm -mcpu=cortex-a8 -mtriple arm-linux-gnu -o - | FileCheck %s 2; This test is fairly fragile. The goal is to ensure that "large" stack 3; objects are allocated closest to the stack protector (i.e., farthest away 4; from the Stack Pointer.) In standard SSP mode this means that large (>= 5; ssp-buffer-size) arrays and structures containing such arrays are 6; closet to the protector. With sspstrong and sspreq this means large 7; arrays/structures-with-arrays are closest, followed by small (< ssp-buffer-size) 8; arrays/structures-with-arrays, and then addr-taken variables. 9; 10; Ideally, we only want verify that the objects appear in the correct groups 11; and that the groups have the correct relative stack offset. The ordering 12; within a group is not relevant to this test. Unfortunately, there is not 13; an elegant way to do this, so just match the offset for each object. 14 15%struct.struct_large_char = type { [8 x i8] } 16%struct.struct_large_char2 = type { [2 x i8], [8 x i8] } 17%struct.struct_small_char = type { [2 x i8] } 18%struct.struct_large_nonchar = type { [8 x i32] } 19%struct.struct_small_nonchar = type { [2 x i16] } 20 21define void @layout_ssp() ssp { 22entry: 23; Expected stack layout for ssp is 24; 180 large_char . Group 1, nested arrays, arrays >= ssp-buffer-size 25; 172 struct_large_char . 26; 168 scalar1 | Everything else 27; 164 scalar2 28; 160 scalar3 29; 156 addr-of 30; 152 small_nonchar (84+68) 31; 112 large_nonchar 32; 110 small_char 33; 108 struct_small_char 34; 72 struct_large_nonchar 35; 68 struct_small_nonchar 36 37; CHECK: layout_ssp: 38; r[[SP]] is used as an offset into the stack later 39; CHECK: add r[[SP:[0-9]+]], sp, #68 40 41; CHECK: bl get_scalar1 42; CHECK: str r0, [sp, #168] 43; CHECK: bl end_scalar1 44 45; CHECK: bl get_scalar2 46; CHECK: str r0, [sp, #164] 47; CHECK: bl end_scalar2 48 49; CHECK: bl get_scalar3 50; CHECK: str r0, [sp, #160] 51; CHECK: bl end_scalar3 52 53; CHECK: bl get_addrof 54; CHECK: str r0, [sp, #156] 55; CHECK: bl end_addrof 56 57; CHECK: get_small_nonchar 58; CHECK: strh r0, [r[[SP]], #84] 59; CHECK: bl end_small_nonchar 60 61; CHECK: bl get_large_nonchar 62; CHECK: str r0, [sp, #112] 63; CHECK: bl end_large_nonchar 64 65; CHECK: bl get_small_char 66; CHECK: strb r0, [sp, #110] 67; CHECK: bl end_small_char 68 69; CHECK: bl get_large_char 70; CHECK: strb r0, [sp, #180] 71; CHECK: bl end_large_char 72 73; CHECK: bl get_struct_large_char 74; CHECK: strb r0, [sp, #172] 75; CHECK: bl end_struct_large_char 76 77; CHECK: bl get_struct_small_char 78; CHECK: strb r0, [sp, #108] 79; CHECK: bl end_struct_small_char 80 81; CHECK: bl get_struct_large_nonchar 82; CHECK:str r0, [sp, #72] 83; CHECK: bl end_struct_large_nonchar 84 85; CHECK: bl get_struct_small_nonchar 86; CHECK: strh r0, [r[[SP]]] 87; CHECK: bl end_struct_small_nonchar 88 %x = alloca i32, align 4 89 %y = alloca i32, align 4 90 %z = alloca i32, align 4 91 %ptr = alloca i32, align 4 92 %small2 = alloca [2 x i16], align 2 93 %large2 = alloca [8 x i32], align 16 94 %small = alloca [2 x i8], align 1 95 %large = alloca [8 x i8], align 1 96 %a = alloca %struct.struct_large_char, align 1 97 %b = alloca %struct.struct_small_char, align 1 98 %c = alloca %struct.struct_large_nonchar, align 8 99 %d = alloca %struct.struct_small_nonchar, align 2 100 %call = call i32 @get_scalar1() 101 store i32 %call, i32* %x, align 4 102 call void @end_scalar1() 103 %call1 = call i32 @get_scalar2() 104 store i32 %call1, i32* %y, align 4 105 call void @end_scalar2() 106 %call2 = call i32 @get_scalar3() 107 store i32 %call2, i32* %z, align 4 108 call void @end_scalar3() 109 %call3 = call i32 @get_addrof() 110 store i32 %call3, i32* %ptr, align 4 111 call void @end_addrof() 112 %call4 = call signext i16 @get_small_nonchar() 113 %arrayidx = getelementptr inbounds [2 x i16], [2 x i16]* %small2, i32 0, i64 0 114 store i16 %call4, i16* %arrayidx, align 2 115 call void @end_small_nonchar() 116 %call5 = call i32 @get_large_nonchar() 117 %arrayidx6 = getelementptr inbounds [8 x i32], [8 x i32]* %large2, i32 0, i64 0 118 store i32 %call5, i32* %arrayidx6, align 4 119 call void @end_large_nonchar() 120 %call7 = call signext i8 @get_small_char() 121 %arrayidx8 = getelementptr inbounds [2 x i8], [2 x i8]* %small, i32 0, i64 0 122 store i8 %call7, i8* %arrayidx8, align 1 123 call void @end_small_char() 124 %call9 = call signext i8 @get_large_char() 125 %arrayidx10 = getelementptr inbounds [8 x i8], [8 x i8]* %large, i32 0, i64 0 126 store i8 %call9, i8* %arrayidx10, align 1 127 call void @end_large_char() 128 %call11 = call signext i8 @get_struct_large_char() 129 %foo = getelementptr inbounds %struct.struct_large_char, %struct.struct_large_char* %a, i32 0, i32 0 130 %arrayidx12 = getelementptr inbounds [8 x i8], [8 x i8]* %foo, i32 0, i64 0 131 store i8 %call11, i8* %arrayidx12, align 1 132 call void @end_struct_large_char() 133 %call13 = call signext i8 @get_struct_small_char() 134 %foo14 = getelementptr inbounds %struct.struct_small_char, %struct.struct_small_char* %b, i32 0, i32 0 135 %arrayidx15 = getelementptr inbounds [2 x i8], [2 x i8]* %foo14, i32 0, i64 0 136 store i8 %call13, i8* %arrayidx15, align 1 137 call void @end_struct_small_char() 138 %call16 = call i32 @get_struct_large_nonchar() 139 %foo17 = getelementptr inbounds %struct.struct_large_nonchar, %struct.struct_large_nonchar* %c, i32 0, i32 0 140 %arrayidx18 = getelementptr inbounds [8 x i32], [8 x i32]* %foo17, i32 0, i64 0 141 store i32 %call16, i32* %arrayidx18, align 4 142 call void @end_struct_large_nonchar() 143 %call19 = call signext i16 @get_struct_small_nonchar() 144 %foo20 = getelementptr inbounds %struct.struct_small_nonchar, %struct.struct_small_nonchar* %d, i32 0, i32 0 145 %arrayidx21 = getelementptr inbounds [2 x i16], [2 x i16]* %foo20, i32 0, i64 0 146 store i16 %call19, i16* %arrayidx21, align 2 147 call void @end_struct_small_nonchar() 148 %arraydecay = getelementptr inbounds [8 x i8], [8 x i8]* %large, i32 0, i32 0 149 %arraydecay22 = getelementptr inbounds [2 x i8], [2 x i8]* %small, i32 0, i32 0 150 %arraydecay23 = getelementptr inbounds [8 x i32], [8 x i32]* %large2, i32 0, i32 0 151 %arraydecay24 = getelementptr inbounds [2 x i16], [2 x i16]* %small2, i32 0, i32 0 152 %0 = load i32, i32* %x, align 4 153 %1 = load i32, i32* %y, align 4 154 %2 = load i32, i32* %z, align 4 155 %coerce.dive = getelementptr %struct.struct_large_char, %struct.struct_large_char* %a, i32 0, i32 0 156 %3 = bitcast [8 x i8]* %coerce.dive to i64* 157 %4 = load i64, i64* %3, align 1 158 %coerce.dive25 = getelementptr %struct.struct_small_char, %struct.struct_small_char* %b, i32 0, i32 0 159 %5 = bitcast [2 x i8]* %coerce.dive25 to i16* 160 %6 = load i16, i16* %5, align 1 161 %coerce.dive26 = getelementptr %struct.struct_small_nonchar, %struct.struct_small_nonchar* %d, i32 0, i32 0 162 %7 = bitcast [2 x i16]* %coerce.dive26 to i32* 163 %8 = load i32, i32* %7, align 1 164 call void @takes_all(i64 %4, i16 %6, %struct.struct_large_nonchar* byval align 8 %c, i32 %8, i8* %arraydecay, i8* %arraydecay22, i32* %arraydecay23, i16* %arraydecay24, i32* %ptr, i32 %0, i32 %1, i32 %2) 165 ret void 166} 167 168define void @layout_sspstrong() sspstrong { 169entry: 170; Expected stack layout for sspstrong is 171; 144 large_nonchar . Group 1, nested arrays, 172; 136 large_char . arrays >= ssp-buffer-size 173; 128 struct_large_char . 174; 96 struct_large_nonchar . 175; 84+8 small_non_char | Group 2, nested arrays, 176; 90 small_char | arrays < ssp-buffer-size 177; 88 struct_small_char | 178; 84 struct_small_nonchar | 179; 80 addrof * Group 3, addr-of local 180; 76 scalar1 + Group 4, everything else 181; 72 scalar2 + 182; 68 scalar3 + 183; 184; CHECK: layout_sspstrong: 185; r[[SP]] is used as an offset into the stack later 186; CHECK: add r[[SP:[0-9]+]], sp, #84 187 188; CHECK: bl get_scalar1 189; CHECK: str r0, [sp, #76] 190; CHECK: bl end_scalar1 191 192; CHECK: bl get_scalar2 193; CHECK: str r0, [sp, #72] 194; CHECK: bl end_scalar2 195 196; CHECK: bl get_scalar3 197; CHECK: str r0, [sp, #68] 198; CHECK: bl end_scalar3 199 200; CHECK: bl get_addrof 201; CHECK: str r0, [sp, #80] 202; CHECK: bl end_addrof 203 204; CHECK: get_small_nonchar 205; CHECK: strh r0, [r[[SP]], #8] 206; CHECK: bl end_small_nonchar 207 208; CHECK: bl get_large_nonchar 209; CHECK: str r0, [sp, #144] 210; CHECK: bl end_large_nonchar 211 212; CHECK: bl get_small_char 213; CHECK: strb r0, [sp, #90] 214; CHECK: bl end_small_char 215 216; CHECK: bl get_large_char 217; CHECK: strb r0, [sp, #136] 218; CHECK: bl end_large_char 219 220; CHECK: bl get_struct_large_char 221; CHECK: strb r0, [sp, #128] 222; CHECK: bl end_struct_large_char 223 224; CHECK: bl get_struct_small_char 225; CHECK: strb r0, [sp, #88] 226; CHECK: bl end_struct_small_char 227 228; CHECK: bl get_struct_large_nonchar 229; CHECK: str r0, [sp, #96] 230; CHECK: bl end_struct_large_nonchar 231 232; CHECK: bl get_struct_small_nonchar 233; CHECK: strh r0, [r[[SP]]] 234; CHECK: bl end_struct_small_nonchar 235 %x = alloca i32, align 4 236 %y = alloca i32, align 4 237 %z = alloca i32, align 4 238 %ptr = alloca i32, align 4 239 %small2 = alloca [2 x i16], align 2 240 %large2 = alloca [8 x i32], align 16 241 %small = alloca [2 x i8], align 1 242 %large = alloca [8 x i8], align 1 243 %a = alloca %struct.struct_large_char, align 1 244 %b = alloca %struct.struct_small_char, align 1 245 %c = alloca %struct.struct_large_nonchar, align 8 246 %d = alloca %struct.struct_small_nonchar, align 2 247 %call = call i32 @get_scalar1() 248 store i32 %call, i32* %x, align 4 249 call void @end_scalar1() 250 %call1 = call i32 @get_scalar2() 251 store i32 %call1, i32* %y, align 4 252 call void @end_scalar2() 253 %call2 = call i32 @get_scalar3() 254 store i32 %call2, i32* %z, align 4 255 call void @end_scalar3() 256 %call3 = call i32 @get_addrof() 257 store i32 %call3, i32* %ptr, align 4 258 call void @end_addrof() 259 %call4 = call signext i16 @get_small_nonchar() 260 %arrayidx = getelementptr inbounds [2 x i16], [2 x i16]* %small2, i32 0, i64 0 261 store i16 %call4, i16* %arrayidx, align 2 262 call void @end_small_nonchar() 263 %call5 = call i32 @get_large_nonchar() 264 %arrayidx6 = getelementptr inbounds [8 x i32], [8 x i32]* %large2, i32 0, i64 0 265 store i32 %call5, i32* %arrayidx6, align 4 266 call void @end_large_nonchar() 267 %call7 = call signext i8 @get_small_char() 268 %arrayidx8 = getelementptr inbounds [2 x i8], [2 x i8]* %small, i32 0, i64 0 269 store i8 %call7, i8* %arrayidx8, align 1 270 call void @end_small_char() 271 %call9 = call signext i8 @get_large_char() 272 %arrayidx10 = getelementptr inbounds [8 x i8], [8 x i8]* %large, i32 0, i64 0 273 store i8 %call9, i8* %arrayidx10, align 1 274 call void @end_large_char() 275 %call11 = call signext i8 @get_struct_large_char() 276 %foo = getelementptr inbounds %struct.struct_large_char, %struct.struct_large_char* %a, i32 0, i32 0 277 %arrayidx12 = getelementptr inbounds [8 x i8], [8 x i8]* %foo, i32 0, i64 0 278 store i8 %call11, i8* %arrayidx12, align 1 279 call void @end_struct_large_char() 280 %call13 = call signext i8 @get_struct_small_char() 281 %foo14 = getelementptr inbounds %struct.struct_small_char, %struct.struct_small_char* %b, i32 0, i32 0 282 %arrayidx15 = getelementptr inbounds [2 x i8], [2 x i8]* %foo14, i32 0, i64 0 283 store i8 %call13, i8* %arrayidx15, align 1 284 call void @end_struct_small_char() 285 %call16 = call i32 @get_struct_large_nonchar() 286 %foo17 = getelementptr inbounds %struct.struct_large_nonchar, %struct.struct_large_nonchar* %c, i32 0, i32 0 287 %arrayidx18 = getelementptr inbounds [8 x i32], [8 x i32]* %foo17, i32 0, i64 0 288 store i32 %call16, i32* %arrayidx18, align 4 289 call void @end_struct_large_nonchar() 290 %call19 = call signext i16 @get_struct_small_nonchar() 291 %foo20 = getelementptr inbounds %struct.struct_small_nonchar, %struct.struct_small_nonchar* %d, i32 0, i32 0 292 %arrayidx21 = getelementptr inbounds [2 x i16], [2 x i16]* %foo20, i32 0, i64 0 293 store i16 %call19, i16* %arrayidx21, align 2 294 call void @end_struct_small_nonchar() 295 %arraydecay = getelementptr inbounds [8 x i8], [8 x i8]* %large, i32 0, i32 0 296 %arraydecay22 = getelementptr inbounds [2 x i8], [2 x i8]* %small, i32 0, i32 0 297 %arraydecay23 = getelementptr inbounds [8 x i32], [8 x i32]* %large2, i32 0, i32 0 298 %arraydecay24 = getelementptr inbounds [2 x i16], [2 x i16]* %small2, i32 0, i32 0 299 %0 = load i32, i32* %x, align 4 300 %1 = load i32, i32* %y, align 4 301 %2 = load i32, i32* %z, align 4 302 %coerce.dive = getelementptr %struct.struct_large_char, %struct.struct_large_char* %a, i32 0, i32 0 303 %3 = bitcast [8 x i8]* %coerce.dive to i64* 304 %4 = load i64, i64* %3, align 1 305 %coerce.dive25 = getelementptr %struct.struct_small_char, %struct.struct_small_char* %b, i32 0, i32 0 306 %5 = bitcast [2 x i8]* %coerce.dive25 to i16* 307 %6 = load i16, i16* %5, align 1 308 %coerce.dive26 = getelementptr %struct.struct_small_nonchar, %struct.struct_small_nonchar* %d, i32 0, i32 0 309 %7 = bitcast [2 x i16]* %coerce.dive26 to i32* 310 %8 = load i32, i32* %7, align 1 311 call void @takes_all(i64 %4, i16 %6, %struct.struct_large_nonchar* byval align 8 %c, i32 %8, i8* %arraydecay, i8* %arraydecay22, i32* %arraydecay23, i16* %arraydecay24, i32* %ptr, i32 %0, i32 %1, i32 %2) 312 ret void 313} 314 315define void @layout_sspreq() sspreq { 316entry: 317; Expected stack layout for sspreq is the same as sspstrong 318; 319; CHECK: layout_sspreq: 320; r[[SP]] is used as an offset into the stack later 321; CHECK: add r[[SP:[0-9]+]], sp, #84 322 323; CHECK: bl get_scalar1 324; CHECK: str r0, [sp, #76] 325; CHECK: bl end_scalar1 326 327; CHECK: bl get_scalar2 328; CHECK: str r0, [sp, #72] 329; CHECK: bl end_scalar2 330 331; CHECK: bl get_scalar3 332; CHECK: str r0, [sp, #68] 333; CHECK: bl end_scalar3 334 335; CHECK: bl get_addrof 336; CHECK: str r0, [sp, #80] 337; CHECK: bl end_addrof 338 339; CHECK: get_small_nonchar 340; CHECK: strh r0, [r[[SP]], #8] 341; CHECK: bl end_small_nonchar 342 343; CHECK: bl get_large_nonchar 344; CHECK: str r0, [sp, #144] 345; CHECK: bl end_large_nonchar 346 347; CHECK: bl get_small_char 348; CHECK: strb r0, [sp, #90] 349; CHECK: bl end_small_char 350 351; CHECK: bl get_large_char 352; CHECK: strb r0, [sp, #136] 353; CHECK: bl end_large_char 354 355; CHECK: bl get_struct_large_char 356; CHECK: strb r0, [sp, #128] 357; CHECK: bl end_struct_large_char 358 359; CHECK: bl get_struct_small_char 360; CHECK: strb r0, [sp, #88] 361; CHECK: bl end_struct_small_char 362 363; CHECK: bl get_struct_large_nonchar 364; CHECK: str r0, [sp, #96] 365; CHECK: bl end_struct_large_nonchar 366 367; CHECK: bl get_struct_small_nonchar 368; CHECK: strh r0, [r[[SP]]] 369; CHECK: bl end_struct_small_nonchar 370 %x = alloca i32, align 4 371 %y = alloca i32, align 4 372 %z = alloca i32, align 4 373 %ptr = alloca i32, align 4 374 %small2 = alloca [2 x i16], align 2 375 %large2 = alloca [8 x i32], align 16 376 %small = alloca [2 x i8], align 1 377 %large = alloca [8 x i8], align 1 378 %a = alloca %struct.struct_large_char, align 1 379 %b = alloca %struct.struct_small_char, align 1 380 %c = alloca %struct.struct_large_nonchar, align 8 381 %d = alloca %struct.struct_small_nonchar, align 2 382 %call = call i32 @get_scalar1() 383 store i32 %call, i32* %x, align 4 384 call void @end_scalar1() 385 %call1 = call i32 @get_scalar2() 386 store i32 %call1, i32* %y, align 4 387 call void @end_scalar2() 388 %call2 = call i32 @get_scalar3() 389 store i32 %call2, i32* %z, align 4 390 call void @end_scalar3() 391 %call3 = call i32 @get_addrof() 392 store i32 %call3, i32* %ptr, align 4 393 call void @end_addrof() 394 %call4 = call signext i16 @get_small_nonchar() 395 %arrayidx = getelementptr inbounds [2 x i16], [2 x i16]* %small2, i32 0, i64 0 396 store i16 %call4, i16* %arrayidx, align 2 397 call void @end_small_nonchar() 398 %call5 = call i32 @get_large_nonchar() 399 %arrayidx6 = getelementptr inbounds [8 x i32], [8 x i32]* %large2, i32 0, i64 0 400 store i32 %call5, i32* %arrayidx6, align 4 401 call void @end_large_nonchar() 402 %call7 = call signext i8 @get_small_char() 403 %arrayidx8 = getelementptr inbounds [2 x i8], [2 x i8]* %small, i32 0, i64 0 404 store i8 %call7, i8* %arrayidx8, align 1 405 call void @end_small_char() 406 %call9 = call signext i8 @get_large_char() 407 %arrayidx10 = getelementptr inbounds [8 x i8], [8 x i8]* %large, i32 0, i64 0 408 store i8 %call9, i8* %arrayidx10, align 1 409 call void @end_large_char() 410 %call11 = call signext i8 @get_struct_large_char() 411 %foo = getelementptr inbounds %struct.struct_large_char, %struct.struct_large_char* %a, i32 0, i32 0 412 %arrayidx12 = getelementptr inbounds [8 x i8], [8 x i8]* %foo, i32 0, i64 0 413 store i8 %call11, i8* %arrayidx12, align 1 414 call void @end_struct_large_char() 415 %call13 = call signext i8 @get_struct_small_char() 416 %foo14 = getelementptr inbounds %struct.struct_small_char, %struct.struct_small_char* %b, i32 0, i32 0 417 %arrayidx15 = getelementptr inbounds [2 x i8], [2 x i8]* %foo14, i32 0, i64 0 418 store i8 %call13, i8* %arrayidx15, align 1 419 call void @end_struct_small_char() 420 %call16 = call i32 @get_struct_large_nonchar() 421 %foo17 = getelementptr inbounds %struct.struct_large_nonchar, %struct.struct_large_nonchar* %c, i32 0, i32 0 422 %arrayidx18 = getelementptr inbounds [8 x i32], [8 x i32]* %foo17, i32 0, i64 0 423 store i32 %call16, i32* %arrayidx18, align 4 424 call void @end_struct_large_nonchar() 425 %call19 = call signext i16 @get_struct_small_nonchar() 426 %foo20 = getelementptr inbounds %struct.struct_small_nonchar, %struct.struct_small_nonchar* %d, i32 0, i32 0 427 %arrayidx21 = getelementptr inbounds [2 x i16], [2 x i16]* %foo20, i32 0, i64 0 428 store i16 %call19, i16* %arrayidx21, align 2 429 call void @end_struct_small_nonchar() 430 %arraydecay = getelementptr inbounds [8 x i8], [8 x i8]* %large, i32 0, i32 0 431 %arraydecay22 = getelementptr inbounds [2 x i8], [2 x i8]* %small, i32 0, i32 0 432 %arraydecay23 = getelementptr inbounds [8 x i32], [8 x i32]* %large2, i32 0, i32 0 433 %arraydecay24 = getelementptr inbounds [2 x i16], [2 x i16]* %small2, i32 0, i32 0 434 %0 = load i32, i32* %x, align 4 435 %1 = load i32, i32* %y, align 4 436 %2 = load i32, i32* %z, align 4 437 %coerce.dive = getelementptr %struct.struct_large_char, %struct.struct_large_char* %a, i32 0, i32 0 438 %3 = bitcast [8 x i8]* %coerce.dive to i64* 439 %4 = load i64, i64* %3, align 1 440 %coerce.dive25 = getelementptr %struct.struct_small_char, %struct.struct_small_char* %b, i32 0, i32 0 441 %5 = bitcast [2 x i8]* %coerce.dive25 to i16* 442 %6 = load i16, i16* %5, align 1 443 %coerce.dive26 = getelementptr %struct.struct_small_nonchar, %struct.struct_small_nonchar* %d, i32 0, i32 0 444 %7 = bitcast [2 x i16]* %coerce.dive26 to i32* 445 %8 = load i32, i32* %7, align 1 446 call void @takes_all(i64 %4, i16 %6, %struct.struct_large_nonchar* byval align 8 %c, i32 %8, i8* %arraydecay, i8* %arraydecay22, i32* %arraydecay23, i16* %arraydecay24, i32* %ptr, i32 %0, i32 %1, i32 %2) 447 ret void 448} 449 450define void @struct_with_protectable_arrays() sspstrong { 451entry: 452; Check to ensure that a structure which contains a small array followed by a 453; large array is assigned to the stack properly as a large object. 454; CHECK: struct_with_protectable_arrays: 455; CHECK: bl get_struct_small_char 456; CHECK: strb r0, [sp, #68] 457; CHECK: bl end_struct_small_char 458; CHECK: bl get_struct_large_char2 459; CHECK: strb r0, [sp, #106] 460; CHECK: bl end_struct_large_char2 461 %a = alloca %struct.struct_small_char, align 1 462 %b = alloca %struct.struct_large_char2, align 1 463 %d1 = alloca %struct.struct_large_nonchar, align 8 464 %d2 = alloca %struct.struct_small_nonchar, align 2 465 %call = call signext i8 @get_struct_small_char() 466 %foo = getelementptr inbounds %struct.struct_small_char, %struct.struct_small_char* %a, i32 0, i32 0 467 %arrayidx = getelementptr inbounds [2 x i8], [2 x i8]* %foo, i32 0, i64 0 468 store i8 %call, i8* %arrayidx, align 1 469 call void @end_struct_small_char() 470 %call1 = call signext i8 @get_struct_large_char2() 471 %foo2 = getelementptr inbounds %struct.struct_large_char2, %struct.struct_large_char2* %b, i32 0, i32 1 472 %arrayidx3 = getelementptr inbounds [8 x i8], [8 x i8]* %foo2, i32 0, i64 0 473 store i8 %call1, i8* %arrayidx3, align 1 474 call void @end_struct_large_char2() 475 %0 = bitcast %struct.struct_large_char2* %b to %struct.struct_large_char* 476 %coerce.dive = getelementptr %struct.struct_large_char, %struct.struct_large_char* %0, i32 0, i32 0 477 %1 = bitcast [8 x i8]* %coerce.dive to i64* 478 %2 = load i64, i64* %1, align 1 479 %coerce.dive4 = getelementptr %struct.struct_small_char, %struct.struct_small_char* %a, i32 0, i32 0 480 %3 = bitcast [2 x i8]* %coerce.dive4 to i16* 481 %4 = load i16, i16* %3, align 1 482 %coerce.dive5 = getelementptr %struct.struct_small_nonchar, %struct.struct_small_nonchar* %d2, i32 0, i32 0 483 %5 = bitcast [2 x i16]* %coerce.dive5 to i32* 484 %6 = load i32, i32* %5, align 1 485 call void @takes_all(i64 %2, i16 %4, %struct.struct_large_nonchar* byval align 8 %d1, i32 %6, i8* null, i8* null, i32* null, i16* null, i32* null, i32 0, i32 0, i32 0) 486 ret void 487} 488 489declare i32 @get_scalar1() 490declare void @end_scalar1() 491 492declare i32 @get_scalar2() 493declare void @end_scalar2() 494 495declare i32 @get_scalar3() 496declare void @end_scalar3() 497 498declare i32 @get_addrof() 499declare void @end_addrof() 500 501declare signext i16 @get_small_nonchar() 502declare void @end_small_nonchar() 503 504declare i32 @get_large_nonchar() 505declare void @end_large_nonchar() 506 507declare signext i8 @get_small_char() 508declare void @end_small_char() 509 510declare signext i8 @get_large_char() 511declare void @end_large_char() 512 513declare signext i8 @get_struct_large_char() 514declare void @end_struct_large_char() 515 516declare signext i8 @get_struct_large_char2() 517declare void @end_struct_large_char2() 518 519declare signext i8 @get_struct_small_char() 520declare void @end_struct_small_char() 521 522declare i32 @get_struct_large_nonchar() 523declare void @end_struct_large_nonchar() 524 525declare signext i16 @get_struct_small_nonchar() 526declare void @end_struct_small_nonchar() 527 528declare void @takes_all(i64, i16, %struct.struct_large_nonchar* byval align 8, i32, i8*, i8*, i32*, i16*, i32*, i32, i32, i32) 529