[Fortran Support] Add pattern match for Fortran Arrays that are parameters.
[polly-mirror.git] / test / ScopInfo / fortran_array_param_nonmalloc_nonvectored.ll
blob59e6c7d25e299591afb6d01fe0e3d7707d898a56
1 ; RUN: opt %loadPolly -analyze -polly-detect-fortran-arrays \
2 ; RUN: -polly-scops -polly-allow-nonaffine -polly-invariant-load-hoisting < %s | FileCheck %s
4 ; This testcase is the corresponding LLVM for testfunc:
5 ; PROGRAM main
6 ;     INTEGER, DIMENSION(1) :: xs
8 ;     CALL testfunc(xs, 10)
9 ; CONTAINS
10 ;     SUBROUTINE func(xs, n)
11 ;         IMPLICIT NONE
12 ;         INTEGER, DIMENSION(:), INTENT(INOUT) :: xs
13 ;         INTEGER, INTENT(IN) :: n
14 ;         INTEGER :: i
16 ;         DO i = 1, n
17 ;             xs(i) = 1
18 ;         END DO
20 ;     END SUBROUTINE func
21 ; END PROGRAM
23 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"
24 target triple = "x86_64-unknown-linux-gnu"
26 module asm "\09.ident\09\22GCC: (GNU) 4.6.4 LLVM: 3.3.1\22"
28 %"struct.array1_integer(kind=4)" = type { i8*, i64, i64, [1 x %struct.descriptor_dimension] }
29 %struct.descriptor_dimension = type { i64, i64, i64 }
31 define internal void @testfunc(%"struct.array1_integer(kind=4)"* noalias %xs, i32* noalias %n) {
32 entry:
33   br label %entry.split
35 entry.split:                                      ; preds = %entry
36   %tmp = getelementptr inbounds %"struct.array1_integer(kind=4)", %"struct.array1_integer(kind=4)"* %xs, i64 0, i32 3, i64 0, i32 0
37   %tmp1 = load i64, i64* %tmp, align 8
38   %tmp2 = icmp eq i64 %tmp1, 0
39   %tmp3 = select i1 %tmp2, i64 1, i64 %tmp1
40   %tmp4 = bitcast %"struct.array1_integer(kind=4)"* %xs to i32**
41   %tmp5 = load i32*, i32** %tmp4, align 8
42   %tmp6 = load i32, i32* %n, align 4
43   %tmp7 = icmp sgt i32 %tmp6, 0
44   br i1 %tmp7, label %"6.preheader", label %return
46 "6.preheader":                                    ; preds = %entry.split
47   br label %"6"
49 "6":                                              ; preds = %"6", %"6.preheader"
50   %tmp8 = phi i32 [ %tmp14, %"6" ], [ 1, %"6.preheader" ]
51   %tmp9 = sext i32 %tmp8 to i64
52   %tmp10 = mul i64 %tmp3, %tmp9
53   %tmp11 = sub i64 %tmp10, %tmp3
54   %tmp12 = getelementptr i32, i32* %tmp5, i64 %tmp11
55   store i32 1, i32* %tmp12, align 4
56   %tmp13 = icmp eq i32 %tmp8, %tmp6
57   %tmp14 = add i32 %tmp8, 1
58   br i1 %tmp13, label %return.loopexit, label %"6"
60 return.loopexit:                                  ; preds = %"6"
61   br label %return
63 return:                                           ; preds = %return.loopexit, %entry.split
64   ret void
67 ; CHECK: ReadAccess :=  [Reduction Type: NONE] [Fortran array descriptor: xs] [Scalar: 0]