1; RUN: opt %loadPolly -polly-detect  -analyze < %s | FileCheck %s
2
3; void f(long A[], long N) {
4;   long i;
5;   long i_non_canonical = 1;
6;   for (i = 0; i < N; ++i) {
7;     A[i] = i_non_canonical;
8;     i_non_canonical += 1;
9;   }
10; }
11
12target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
13
14define void @f(i64* %A, i64 %N) nounwind {
15entry:
16  %cmp = icmp sgt i64 %N, 0
17  br i1 %cmp, label %for.i, label %return
18
19for.i:
20  %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.i ]
21  %indvar_non_canonical = phi i64 [ 1, %entry ], [ %indvar_non_canonical.next, %for.i ]
22  %scevgep = getelementptr i64, i64* %A, i64 %indvar
23  store i64 %indvar_non_canonical, i64* %scevgep
24  %indvar.next = add nsw i64 %indvar, 1
25  %indvar_non_canonical.next = add nsw i64 %indvar_non_canonical, 1
26  %exitcond = icmp eq i64 %indvar.next, %N
27  br i1 %exitcond, label %return, label %for.i
28
29return:
30  ret void
31}
32
33; CHECK: Valid Region for Scop: for.i => return
34