1 ; RUN: opt %loadPolly -basic-aa -loop-rotate -indvars -polly-prepare -polly-print-scops -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -basic-aa -loop-rotate -indvars -licm -polly-prepare -polly-scops -disable-output < %s | FileCheck %s
6 ; Even ScopDetection fails here after LICM because of PHI in exit node.
8 ; void foo(unsigned long *restrict A, unsigned long *restrict B,
10 ; for (unsigned long i = 0; i < 100; i++)
11 ; for (unsigned long k = 0; k < 100; k++)
15 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17 define void @foo(ptr noalias %A, ptr noalias %B, i64 %j) {
21 for.cond: ; preds = %for.inc.6, %entry
22 %i.0 = phi i64 [ 0, %entry ], [ %inc7, %for.inc.6 ]
23 %exitcond1 = icmp ne i64 %i.0, 100
24 br i1 %exitcond1, label %for.body, label %for.end.8
26 for.body: ; preds = %for.cond
29 for.cond.1: ; preds = %for.inc, %for.body
30 %k.0 = phi i64 [ 0, %for.body ], [ %inc, %for.inc ]
31 %exitcond = icmp ne i64 %k.0, 100
32 br i1 %exitcond, label %for.body.3, label %for.end
34 for.body.3: ; preds = %for.cond.1
35 %add = add nuw nsw i64 %i.0, %k.0
36 %arrayidx = getelementptr inbounds i64, ptr %B, i64 %add
37 %tmp = load i64, ptr %arrayidx, align 8
38 %arrayidx4 = getelementptr inbounds i64, ptr %A, i64 %j
39 %tmp2 = load i64, ptr %arrayidx4, align 8
40 %add5 = add i64 %tmp2, %tmp
41 store i64 %add5, ptr %arrayidx4, align 8
44 for.inc: ; preds = %for.body.3
45 %inc = add nuw nsw i64 %k.0, 1
48 for.end: ; preds = %for.cond.1
51 for.inc.6: ; preds = %for.end
52 %inc7 = add nuw nsw i64 %i.0, 1
55 for.end.8: ; preds = %for.cond
61 ; CHECK: Stmt_for_body_3
62 ; CHECK-DAG: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
63 ; CHECK-NEXT: [j] -> { Stmt_for_body_3[i0, i1] -> MemRef_B[i0 + i1] };
64 ; CHECK-DAG: ReadAccess := [Reduction Type: +] [Scalar: 0]
65 ; CHECK-NEXT: [j] -> { Stmt_for_body_3[i0, i1] -> MemRef_A[j] };
66 ; CHECK-DAG: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
67 ; CHECK-NEXT: [j] -> { Stmt_for_body_3[i0, i1] -> MemRef_A[j] };