1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s 2; 3; CHECK: Function: f_no_fast_math 4; CHECK: Reduction Type: NONE 5; CHECK: Function: f_fast_math 6; CHECK: Reduction Type: + 7; 8; void f(float *sum) { 9; for (int i = 0; i < 100; i++) 10; *sum += 3.41 * i; 11; } 12target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64" 13 14define void @f_no_fast_math(float* %sum) { 15entry: 16 br label %for.cond 17 18for.cond: ; preds = %for.inc, %entry 19 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] 20 %exitcond = icmp ne i32 %i.0, 100 21 br i1 %exitcond, label %for.body, label %for.end 22 23for.body: ; preds = %for.cond 24 %conv = sitofp i32 %i.0 to float 25 %pi = fptrunc double 3.41 to float 26 %mul = fmul float %conv, %pi 27 %tmp = load float, float* %sum, align 4 28 %add = fadd float %tmp, %mul 29 store float %add, float* %sum, align 4 30 br label %for.inc 31 32for.inc: ; preds = %for.body 33 %inc = add nsw i32 %i.0, 1 34 br label %for.cond 35 36for.end: ; preds = %for.cond 37 ret void 38} 39 40define void @f_fast_math(float* %sum) { 41entry: 42 br label %for.cond 43 44for.cond: ; preds = %for.inc, %entry 45 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] 46 %exitcond = icmp ne i32 %i.0, 100 47 br i1 %exitcond, label %for.body, label %for.end 48 49for.body: ; preds = %for.cond 50 %conv = sitofp i32 %i.0 to float 51 %pi = fptrunc double 3.41 to float 52 %mul = fmul fast float %conv, %pi 53 %tmp = load float, float* %sum, align 4 54 %add = fadd fast float %tmp, %mul 55 store float %add, float* %sum, align 4 56 br label %for.inc 57 58for.inc: ; preds = %for.body 59 %inc = add nsw i32 %i.0, 1 60 br label %for.cond 61 62for.end: ; preds = %for.cond 63 ret void 64} 65