• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -scalarrepl -S | FileCheck %s
2; RUN: opt < %s -scalarrepl-ssa -S | FileCheck %s
3target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32"
4target triple = "thumbv7-apple-darwin10.0.0"
5
6%struct.Vector4 = type { float, float, float, float }
7@f.vector = internal constant %struct.Vector4 { float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 }, align 16
8
9; CHECK: define void @f
10; CHECK-NOT: alloca
11; CHECK: phi <4 x float>
12
13define void @f() nounwind ssp {
14entry:
15  %i = alloca i32, align 4
16  %vector = alloca %struct.Vector4, align 16
17  %agg.tmp = alloca %struct.Vector4, align 16
18  %tmp = bitcast %struct.Vector4* %vector to i8*
19  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp, i8* bitcast (%struct.Vector4* @f.vector to i8*), i32 16, i32 16, i1 false)
20  br label %for.cond
21
22for.cond:                                         ; preds = %for.body, %entry
23  %storemerge = phi i32 [ 0, %entry ], [ %inc, %for.body ]
24  store i32 %storemerge, i32* %i, align 4
25  %cmp = icmp slt i32 %storemerge, 1000000
26  br i1 %cmp, label %for.body, label %for.end
27
28for.body:                                         ; preds = %for.cond
29  %tmp2 = bitcast %struct.Vector4* %agg.tmp to i8*
30  %tmp3 = bitcast %struct.Vector4* %vector to i8*
31  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* %tmp3, i32 16, i32 16, i1 false)
32  %0 = bitcast %struct.Vector4* %agg.tmp to [2 x i64]*
33  %1 = load [2 x i64]* %0, align 16
34  %tmp2.i = extractvalue [2 x i64] %1, 0
35  %tmp3.i = zext i64 %tmp2.i to i128
36  %tmp10.i = bitcast i128 %tmp3.i to <4 x float>
37  %sub.i.i = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %tmp10.i
38  %2 = bitcast %struct.Vector4* %vector to <4 x float>*
39  store <4 x float> %sub.i.i, <4 x float>* %2, align 16
40  %tmp4 = load i32* %i, align 4
41  %inc = add nsw i32 %tmp4, 1
42  br label %for.cond
43
44for.end:                                          ; preds = %for.cond
45  %x = getelementptr inbounds %struct.Vector4* %vector, i32 0, i32 0
46  %tmp5 = load float* %x, align 16
47  %conv = fpext float %tmp5 to double
48  %call = call i32 (...)* @printf(double %conv) nounwind
49  ret void
50}
51
52declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
53declare i32 @printf(...)
54