1 ; RUN: opt %loadPolly -analyze -S -polly-detect-fortran-arrays \
2 ; RUN: -polly-process-unprofitable -polly-scops < %s | FileCheck %s
5 ; USE data_parameters, ONLY : &
6 ; wp, & ! KIND-type parameter for real variables
7 ; iintegers ! KIND-type parameter for standard integer variables
9 ; REAL (KIND = wp), ALLOCATABLE, PRIVATE :: &
13 ; SUBROUTINE terra1(n)
14 ; INTEGER, intent(in) :: n
16 ; INTEGER (KIND=iintegers) :: &
20 ; xdzs(j) = xdzs(j) * xdzs(j) + xdzs(j - 1)
22 ; END SUBROUTINE terra1
25 target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
26 target triple = "x86_64-unknown-linux-gnu"
28 module asm "\09.ident\09\22GCC: (GNU) 4.6.4 LLVM: 3.3.1\22"
30 %"struct.array1_real(kind=8)" = type { i8*, i64, i64, [1 x %struct.descriptor_dimension] }
31 %struct.descriptor_dimension = type { i64, i64, i64 }
33 @__src_soil_MOD_xdzs = unnamed_addr global %"struct.array1_real(kind=8)" zeroinitializer, align 32
35 ; Function Attrs: nounwind uwtable
36 define void @__src_soil_MOD_terra1(i32* noalias nocapture %n) unnamed_addr #0 {
40 entry.split: ; preds = %entry
41 %tmp = load i32, i32* %n, align 4, !tbaa !0
42 %tmp1 = icmp sgt i32 %tmp, 21
43 br i1 %tmp1, label %"3.preheader", label %return
45 "3.preheader": ; preds = %entry.split
46 %tmp2 = load i64, i64* getelementptr inbounds (%"struct.array1_real(kind=8)", %"struct.array1_real(kind=8)"* @__src_soil_MOD_xdzs, i64 0, i32 1), align 8, !tbaa !3
47 %tmp3 = load double*, double** bitcast (%"struct.array1_real(kind=8)"* @__src_soil_MOD_xdzs to double**), align 32, !tbaa !5
48 %tmp4 = add i32 %tmp, 1
51 "3": ; preds = %"3", %"3.preheader"
52 %indvars.iv = phi i64 [ 22, %"3.preheader" ], [ %indvars.iv.next, %"3" ]
53 %tmp5 = add nsw i64 %indvars.iv, %tmp2
54 %tmp6 = getelementptr inbounds double, double* %tmp3, i64 %tmp5
55 %tmp7 = load double, double* %tmp6, align 8, !tbaa !7
56 %tmp8 = fmul double %tmp7, %tmp7
57 %tmp9 = add i64 %tmp2, -1
58 %tmp10 = add i64 %tmp9, %indvars.iv
59 %tmp11 = getelementptr inbounds double, double* %tmp3, i64 %tmp10
60 %tmp12 = load double, double* %tmp11, align 8, !tbaa !7
61 %tmp13 = fadd double %tmp8, %tmp12
62 store double %tmp13, double* %tmp6, align 8, !tbaa !7
63 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
64 %lftr.wideiv1 = trunc i64 %indvars.iv.next to i32
65 %exitcond2 = icmp eq i32 %lftr.wideiv1, %tmp4
66 br i1 %exitcond2, label %return.loopexit, label %"3"
68 return.loopexit: ; preds = %"3"
71 return: ; preds = %return.loopexit, %entry.split
75 attributes #0 = { nounwind uwtable }
78 !1 = !{!"alias set 11: integer(kind=4)", !2}
81 !4 = !{!"alias set 4: integer(kind=8)", !2}
83 !6 = !{!"alias set 3: void*", !2}
85 !8 = !{!"alias set 18: real(kind=8)", !2}
87 ; CHECK: ReadAccess := [Reduction Type: NONE] [Fortran array descriptor: __src_soil_MOD_xdzs] [Scalar: 0]
88 ; CHECK: ReadAccess := [Reduction Type: NONE] [Fortran array descriptor: __src_soil_MOD_xdzs] [Scalar: 0]
89 ; CHECK: MustWriteAccess := [Reduction Type: NONE] [Fortran array descriptor: __src_soil_MOD_xdzs] [Scalar: 0]