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-pr35982.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer fast-math-pr35982.s > fast-math-pr35982.ll
6 ; ModuleID = 'fast-math-pr35982.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 %struct.mem = type { float, i32 }
12 define float @method2_int16(%struct.mem* %mem) nounwind uwtable {
16 for.cond: ; preds = %for.inc, %entry
17 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
18 %avg.0 = phi float [ undef, %entry ], [ %add, %for.inc ]
19 %len = getelementptr %struct.mem* %mem, i64 %indvar, i32 1
20 %scevgep = getelementptr %struct.mem* %mem, i64 %indvar
21 %avg3 = bitcast %struct.mem* %scevgep to float*
22 %exitcond = icmp ne i64 %indvar, 100
23 br i1 %exitcond, label %for.body, label %for.end
25 for.body: ; preds = %for.cond
28 for.inc: ; preds = %for.body
29 %tmp9 = load i32* %len, align 4
30 %conv = sitofp i32 %tmp9 to float
31 %tmp4 = load float* %avg3, align 4
32 %mul = fmul float %tmp4, %conv
33 %add = fadd float %avg.0, %mul
34 %indvar.next = add i64 %indvar, 1
37 for.end: ; preds = %for.cond
38 %avg.0.lcssa = phi float [ %avg.0, %for.cond ]
39 ret float %avg.0.lcssa