1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 fast-math-pr44152.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer fast-math-pr44152.s > fast-math-pr44152.ll
6 ; ModuleID = 'fast-math-pr44152.s'
7 target 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"
8 target triple = "x86_64-unknown-linux-gnu"
10 @a = global [16 x { float, float }] [{ float, float } { float 1.000000e+01, float 2.000000e+01 }, { float, float } { float 1.100000e+01, float 2.100000e+01 }, { float, float } { float 1.200000e+01, float 2.200000e+01 }, { float, float } { float 1.300000e+01, float 2.300000e+01 }, { float, float } { float 1.400000e+01, float 2.400000e+01 }, { float, float } { float 1.500000e+01, float 2.500000e+01 }, { float, float } { float 1.600000e+01, float 2.600000e+01 }, { float, float } { float 1.700000e+01, float 2.700000e+01 }, { float, float } { float 1.800000e+01, float 2.800000e+01 }, { float, float } { float 1.900000e+01, float 2.900000e+01 }, { float, float } { float 2.000000e+01, float 3.000000e+01 }, { float, float } { float 2.100000e+01, float 3.100000e+01 }, { float, float } { float 2.200000e+01, float 3.200000e+01 }, { float, float } { float 2.300000e+01, float 3.300000e+01 }, { float, float } { float 2.400000e+01, float 3.400000e+01 }, { float, float } { float 2.500000e+01, float 3.500000e+01 }], align 16
11 @c = common global [16 x { float, float }] zeroinitializer, align 16
13 define <2 x float> @foo(i32 %x) nounwind uwtable noinline {
15 %retval = alloca <2 x float>, align 8
16 %sum = alloca { float, float }, align 4
17 %real = getelementptr inbounds { float, float }* %sum, i64 0, i32 0
18 %imag = getelementptr inbounds { float, float }* %sum, i64 0, i32 1
19 store float 1.000000e+01, float* %real, align 4
20 store float 2.000000e+01, float* %imag, align 4
21 %tmp = sext i32 %x to i64
24 for.cond: ; preds = %for.inc, %entry
25 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
26 %tmp1 = add i64 %tmp, %indvar
27 %scevgep = getelementptr [16 x { float, float }]* @a, i64 0, i64 %tmp1
28 %tmp3.realp = bitcast { float, float }* %scevgep to float*
29 %tmp3.imagp = getelementptr [16 x { float, float }]* @a, i64 0, i64 %tmp1, i32 1
30 %exitcond = icmp ne i64 %indvar, 16
31 br i1 %exitcond, label %for.body, label %for.end
33 for.body: ; preds = %for.cond
34 %tmp3.real = load float* %tmp3.realp, align 4
35 %tmp3.imag = load float* %tmp3.imagp, align 4
36 %sum.realp = getelementptr inbounds { float, float }* %sum, i64 0, i32 0
37 %sum.real = load float* %sum.realp, align 4
38 %sum.imagp = getelementptr inbounds { float, float }* %sum, i64 0, i32 1
39 %sum.imag = load float* %sum.imagp, align 4
40 %add.r = fadd float %sum.real, %tmp3.real
41 %add.i = fadd float %sum.imag, %tmp3.imag
42 %real4 = getelementptr inbounds { float, float }* %sum, i64 0, i32 0
43 %imag5 = getelementptr inbounds { float, float }* %sum, i64 0, i32 1
44 store float %add.r, float* %real4, align 4
45 store float %add.i, float* %imag5, align 4
48 for.inc: ; preds = %for.body
49 %indvar.next = add i64 %indvar, 1
52 for.end: ; preds = %for.cond
53 %tmpcast = bitcast <2 x float>* %retval to { float, float }*
54 %sum.realp8 = getelementptr inbounds { float, float }* %sum, i64 0, i32 0
55 %sum.real9 = load float* %sum.realp8, align 4
56 %sum.imagp10 = getelementptr inbounds { float, float }* %sum, i64 0, i32 1
57 %sum.imag11 = load float* %sum.imagp10, align 4
58 %add.r12 = fadd float %sum.real9, 6.600000e+01
59 %add.i13 = fadd float %sum.imag11, 0.000000e+00
60 %add.r14 = fadd float %add.r12, 0.000000e+00
61 %add.i15 = fadd float %add.i13, 8.600000e+01
62 store float %add.r14, float* getelementptr inbounds ([16 x { float, float }]* @c, i64 0, i64 0, i32 0), align 16
63 store float %add.i15, float* getelementptr inbounds ([16 x { float, float }]* @c, i64 0, i64 0, i32 1), align 4
64 %real16 = getelementptr inbounds <2 x float>* %retval, i64 0, i64 0
65 %imag17 = getelementptr inbounds { float, float }* %tmpcast, i64 0, i32 1
66 store float 0.000000e+00, float* %real16, align 8
67 store float 0.000000e+00, float* %imag17, align 4
68 %tmp4 = load <2 x float>* %retval, align 8