blob: 868b3af49e30caca01f7f26535da717d8fd5716f [file] [log] [blame]
Tobias Grosser7cb80992016-08-15 15:56:24 +00001; RUN: opt %loadPolly -polly-scops -analyze \
2; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
Tobias Grosser2f8e43d2015-11-24 17:06:38 +00003
4; subroutine init_array(ni, nj, pi, pj, a)
5; implicit none
6;
7; double precision, dimension(nj, ni) :: a
8; integer*8 :: ni, nj
9; integer*8 :: pi, pj
10; integer*8 :: i, j
11;
12; do i = 1, ni
13; do j = 1, nj
14; a(j, i) = i + j
15; end do
16; end do
17; end subroutine
18;
19; Verify we correctly delinearize accesses
20
21; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
22; CHECK: [tmp9, tmp14] -> { Stmt_bb17[i0, i1] -> MemRef_arg4[i0, i1] };
23
24target 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"
25
26define void @ham(i64* noalias %arg, i64* noalias %arg1, i64* noalias %arg2, i64* noalias %arg3, [0 x double]* noalias %arg4) unnamed_addr {
27bb:
28 br label %bb5
29
30bb5: ; preds = %bb
31 %tmp = load i64, i64* %arg1, align 8
32 %tmp6 = icmp slt i64 %tmp, 0
33 %tmp7 = select i1 %tmp6, i64 0, i64 %tmp
34 %tmp8 = xor i64 %tmp7, -1
35 %tmp9 = load i64, i64* %arg, align 8
36 %tmp10 = icmp sgt i64 %tmp9, 0
37 br i1 %tmp10, label %bb11, label %bb32
38
39bb11: ; preds = %bb5
40 br label %bb12
41
42bb12: ; preds = %bb28, %bb11
43 %tmp13 = phi i64 [ %tmp30, %bb28 ], [ 1, %bb11 ]
44 %tmp14 = load i64, i64* %arg1, align 8
45 %tmp15 = icmp sgt i64 %tmp14, 0
46 br i1 %tmp15, label %bb16, label %bb28
47
48bb16: ; preds = %bb12
49 br label %bb17
50
51bb17: ; preds = %bb17, %bb16
52 %tmp18 = phi i64 [ %tmp26, %bb17 ], [ 1, %bb16 ]
53 %tmp19 = mul i64 %tmp13, %tmp7
54 %tmp20 = add i64 %tmp19, %tmp8
55 %tmp21 = add i64 %tmp20, %tmp18
56 %tmp22 = add i64 %tmp18, %tmp13
57 %tmp23 = sitofp i64 %tmp22 to double
58 %tmp24 = getelementptr [0 x double], [0 x double]* %arg4, i64 0, i64 %tmp21
59 store double %tmp23, double* %tmp24, align 8
60 %tmp25 = icmp eq i64 %tmp18, %tmp14
61 %tmp26 = add i64 %tmp18, 1
62 br i1 %tmp25, label %bb27, label %bb17
63
64bb27: ; preds = %bb17
65 br label %bb28
66
67bb28: ; preds = %bb27, %bb12
68 %tmp29 = icmp eq i64 %tmp13, %tmp9
69 %tmp30 = add i64 %tmp13, 1
70 br i1 %tmp29, label %bb31, label %bb12
71
72bb31: ; preds = %bb28
73 br label %bb32
74
75bb32: ; preds = %bb31, %bb5
76 ret void
77}