1; RUN: opt -delinearize -analyze -enable-new-pm=0 < %s | FileCheck %s 2; RUN: opt -passes='print<delinearization>' -disable-output < %s 2>&1 | FileCheck %s 3 4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 5 6; CHECK: Inst: %tmp = load float, float* %arrayidx, align 4 7; CHECK-NEXT: In Loop with Header: for.inc 8; CHECK-NEXT: AccessFunction: {(4 * %N * %call),+,4}<nsw><%for.inc> 9; CHECK-NEXT: Base offset: %A 10; CHECK-NEXT: ArrayDecl[UnknownSize][%N] with elements of 4 bytes. 11; CHECK-NEXT: ArrayRef[%call][{0,+,1}<nuw><nsw><%for.inc>] 12 13; CHECK: Inst: %tmp5 = load float, float* %arrayidx4, align 4 14; CHECK-NEXT: In Loop with Header: for.inc 15; CHECK-NEXT: AccessFunction: {(4 * %call1),+,(4 * %N)}<nsw><%for.inc> 16; CHECK-NEXT: Base offset: %B 17; CHECK-NEXT: ArrayDecl[UnknownSize][%N] with elements of 4 bytes. 18; CHECK-NEXT: ArrayRef[{0,+,1}<nuw><nsw><%for.inc>][%call1] 19 20; Function Attrs: noinline nounwind uwtable 21define void @mat_mul(float* %C, float* %A, float* %B, i64 %N) #0 !kernel_arg_addr_space !2 !kernel_arg_access_qual !3 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 { 22entry: 23 br label %entry.split 24 25entry.split: ; preds = %entry 26 %call = tail call i64 @_Z13get_global_idj(i32 0) #3 27 %call1 = tail call i64 @_Z13get_global_idj(i32 1) #3 28 %cmp1 = icmp sgt i64 %N, 0 29 %mul = mul nsw i64 %call, %N 30 br i1 %cmp1, label %for.inc.lr.ph, label %for.end 31 32for.inc.lr.ph: ; preds = %entry.split 33 br label %for.inc 34 35for.inc: ; preds = %for.inc.lr.ph, %for.inc 36 %acc.03 = phi float [ 0.000000e+00, %for.inc.lr.ph ], [ %tmp6, %for.inc ] 37 %m.02 = phi i64 [ 0, %for.inc.lr.ph ], [ %inc, %for.inc ] 38 %add = add nsw i64 %m.02, %mul 39 %arrayidx = getelementptr inbounds float, float* %A, i64 %add 40 %tmp = load float, float* %arrayidx, align 4 41 %mul2 = mul nsw i64 %m.02, %N 42 %add3 = add nsw i64 %mul2, %call1 43 %arrayidx4 = getelementptr inbounds float, float* %B, i64 %add3 44 %tmp5 = load float, float* %arrayidx4, align 4 45 %tmp6 = tail call float @llvm.fmuladd.f32(float %tmp, float %tmp5, float %acc.03) 46 %inc = add nuw nsw i64 %m.02, 1 47 %exitcond = icmp ne i64 %inc, %N 48 br i1 %exitcond, label %for.inc, label %for.cond.for.end_crit_edge 49 50for.cond.for.end_crit_edge: ; preds = %for.inc 51 %.lcssa = phi float [ %tmp6, %for.inc ] 52 br label %for.end 53 54for.end: ; preds = %for.cond.for.end_crit_edge, %entry.split 55 %acc.0.lcssa = phi float [ %.lcssa, %for.cond.for.end_crit_edge ], [ 0.000000e+00, %entry.split ] 56 %add7 = add nsw i64 %mul, %call1 57 %arrayidx8 = getelementptr inbounds float, float* %C, i64 %add7 58 store float %acc.0.lcssa, float* %arrayidx8, align 4 59 ret void 60} 61 62; Function Attrs: nounwind readnone 63declare i64 @_Z13get_global_idj(i32) #1 64 65; Function Attrs: nounwind readnone speculatable 66declare float @llvm.fmuladd.f32(float, float, float) #2 67 68attributes #0 = { noinline nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 69attributes #1 = { nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 70attributes #2 = { nounwind readnone speculatable } 71attributes #3 = { nounwind readnone } 72 73!llvm.module.flags = !{!0} 74!llvm.ident = !{!1} 75 76!0 = !{i32 1, !"wchar_size", i32 4} 77!1 = !{!"clang version 5.0.0 (trunk 303846) (llvm/trunk 303834)"} 78!2 = !{i32 1, i32 1, i32 1, i32 0} 79!3 = !{!"none", !"none", !"none", !"none"} 80!4 = !{!"float*", !"float*", !"float*", !"long"} 81!5 = !{!"", !"", !"", !""} 82