1 ; RUN: opt %loadPolly -polly-scops -analyze \
2 ; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
4 ; void f(int *A, unsigned N) {
5 ; for (unsigned i = 0; i < N; i++)
6 ; A[i / 3] = A[5 * N / 3];
9 ; CHECK: Invariant Accesses: {
10 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
11 ; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> MemRef_A[o0] : -2 + 5N <= 3o0 <= 5N };
12 ; CHECK-NEXT: Execution Context: [N] -> { : 0 < N <= 1844674407370955161 }
15 ; CHECK: Assumed Context:
16 ; CHECK-NEXT: [N] -> { : }
17 ; CHECK-NEXT: Invalid Context:
18 ; CHECK-NEXT: [N] -> { : N >= 1844674407370955162 }
20 ; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
21 ; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> MemRef_A[o0] : -2 + i0 <= 3o0 <= i0 };
23 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25 define void @f(i32* %A, i64 %N) {
29 for.cond: ; preds = %for.inc, %entry
30 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
31 %exitcond = icmp ne i64 %indvars.iv, %N
32 br i1 %exitcond, label %for.body, label %for.end
34 for.body: ; preds = %for.cond
35 %mul = mul nsw i64 %N, 5
36 %div2 = udiv i64 %mul, 3
37 %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %div2
38 %load = load i32, i32* %arrayidx2, align 4
39 %div = udiv i64 %indvars.iv, 3
40 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %div
41 store i32 %load, i32* %arrayidx, align 4
44 for.inc: ; preds = %for.body
45 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
48 for.end: ; preds = %for.cond