[WebAssembly] Don't perform the returned-argument optimization on constants.
[oota-llvm.git] / test / CodeGen / ARM / align-sp-adjustment.ll
1 ; RUN: llc -mtriple=thumbv7 -o - %s | FileCheck %s
2
3 ; CHECK: [sp, #2120]
4
5 %struct.struct_2 = type { [172 x %struct.struct_1] }
6 %struct.struct_1 = type { i32, i32, i32 }
7
8 @.str = private unnamed_addr constant [2 x i8] c"a\00", align 1
9 @.str.1 = private unnamed_addr constant [2 x i8] c"b\00", align 1
10 @.str.2 = private unnamed_addr constant [2 x i8] c"c\00", align 1
11 @.str.3 = private unnamed_addr constant [2 x i8] c"d\00", align 1
12
13 declare i32* @_Z4bar3iiPKcS0_i(i32, i32, i8*, i8*, i32)
14 declare void @_Z4bar1i8struct_2(i32, %struct.struct_2* byval align 4)
15 declare i32 @_Z4bar2PiPKc(i32*, i8*)
16
17 define void @_Z3fooiiiii(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5) #0 {
18 entry:
19   %params = alloca %struct.struct_2, align 4
20   %0 = bitcast %struct.struct_2* %params to i8*
21   br label %for.body
22
23 for.body:
24   %i.015 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
25   %call = tail call i32* @_Z4bar3iiPKcS0_i(i32 %p1, i32 %p5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i32 %i.015) #4
26   %cmp1 = icmp eq i32* %call, null
27   br i1 %cmp1, label %cleanup.8, label %for.inc
28
29 for.inc:
30   %call2 = tail call i32 @_Z4bar2PiPKc(i32* %call, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0)) #4
31   %f1 = getelementptr inbounds %struct.struct_2, %struct.struct_2* %params, i32 0, i32 0, i32 %i.015, i32 0
32   store i32 %call2, i32* %f1, align 4
33   %call3 = tail call i32 @_Z4bar2PiPKc(i32* %call, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0)) #4
34   %f2 = getelementptr inbounds %struct.struct_2, %struct.struct_2* %params, i32 0, i32 0, i32 %i.015, i32 1
35   store i32 %call3, i32* %f2, align 4
36   %inc = add nuw nsw i32 %i.015, 1
37   %cmp = icmp slt i32 %inc, 4
38   br i1 %cmp, label %for.body, label %for.end
39
40 for.end:
41   call void @_Z4bar1i8struct_2(i32 %p4, %struct.struct_2* byval nonnull align 4 %params) #4
42   br label %cleanup.8
43
44 cleanup.8:
45   ret void
46 }
47