• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-detect -analyze < %s | FileCheck %s
2;
3; CHECK: Valid Region for Scop:
4;
5;    void jd(int *A, int *B, int c) {
6;      for (int i = 0; i < 1024; i++)
7;        A[i] = B[c - 10] + B[5];
8;    }
9;
10target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
11
12define void @jd(i32* %A, i32* %B, i32 %c) {
13entry:
14  br label %for.cond
15
16for.cond:                                         ; preds = %for.inc, %entry
17  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
18  %exitcond = icmp ne i64 %indvars.iv, 1024
19  br i1 %exitcond, label %for.body, label %for.end
20
21for.body:                                         ; preds = %for.cond
22  %sub = add nsw i32 %c, -10
23  %idxprom = sext i32 %sub to i64
24  %arrayidx = getelementptr inbounds i32, i32* %B, i64 %idxprom
25  %tmp = load i32, i32* %arrayidx, align 4
26  %arrayidx1 = getelementptr inbounds i32, i32* %B, i64 5
27  %tmp1 = load i32, i32* %arrayidx1, align 4
28  %add = add nsw i32 %tmp, %tmp1
29  %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
30  store i32 %add, i32* %arrayidx3, align 4
31  br label %for.inc
32
33for.inc:                                          ; preds = %for.body
34  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
35  br label %for.cond
36
37for.end:                                          ; preds = %for.cond
38  ret void
39}
40