• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-codegen -polly-ast-detect-parallel -S < %s | FileCheck %s
2;
3; Check that we mark multiple parallel loops correctly including the memory instructions.
4;
5; CHECK-DAG:  %polly.loop_cond[[COuter:[0-9]*]] = icmp sle i64 %polly.indvar_next{{[0-9]*}}, 1023
6; CHECK-DAG:  br i1 %polly.loop_cond[[COuter]], label %polly.loop_header{{[0-9]*}}, label %polly.loop_exit{{[0-9]*}}, !llvm.loop ![[IDOuter:[0-9]*]]
7;
8; CHECK-DAG:  %polly.loop_cond[[CInner:[0-9]*]] = icmp sle i64 %polly.indvar_next{{[0-9]*}}, 511
9; CHECK-DAG:  br i1 %polly.loop_cond[[CInner]], label %polly.loop_header{{[0-9]*}}, label %polly.loop_exit{{[0-9]*}}, !llvm.loop ![[IDInner:[0-9]*]]
10;
11; CHECK-DAG: store i32 %{{[a-z_0-9]*}}, i32* %{{[a-z_0-9]*}}, {{[ ._!,a-zA-Z0-9]*}}, !llvm.mem.parallel_loop_access !4
12;
13; CHECK-DAG: ![[IDOuter]] = distinct !{![[IDOuter]]}
14; CHECK-DAG: ![[IDInner]] = distinct !{![[IDInner]]}
15; CHECK-DAG: !4 = !{![[IDOuter]], ![[IDInner]]}
16;
17;    void jd(int *A) {
18;      for (int i = 0; i < 1024; i++)
19;        for (int j = 0; j < 512; j++)
20;          A[i * 512 + j] = i + j;
21;    }
22;
23target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
24
25define void @jd(i32* %A) {
26entry:
27  br label %for.cond
28
29for.cond:                                         ; preds = %for.inc5, %entry
30  %indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc5 ], [ 0, %entry ]
31  %exitcond6 = icmp ne i64 %indvars.iv3, 1024
32  br i1 %exitcond6, label %for.body, label %for.end7
33
34for.body:                                         ; preds = %for.cond
35  br label %for.cond1
36
37for.cond1:                                        ; preds = %for.inc, %for.body
38  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body ]
39  %exitcond = icmp ne i64 %indvars.iv, 512
40  br i1 %exitcond, label %for.body3, label %for.end
41
42for.body3:                                        ; preds = %for.cond1
43  %tmp = add nsw i64 %indvars.iv3, %indvars.iv
44  %tmp7 = shl nsw i64 %indvars.iv3, 9
45  %tmp8 = add nsw i64 %tmp7, %indvars.iv
46  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %tmp8
47  %tmp9 = trunc i64 %tmp to i32
48  store i32 %tmp9, i32* %arrayidx, align 4
49  br label %for.inc
50
51for.inc:                                          ; preds = %for.body3
52  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
53  br label %for.cond1
54
55for.end:                                          ; preds = %for.cond1
56  br label %for.inc5
57
58for.inc5:                                         ; preds = %for.end
59  %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
60  br label %for.cond
61
62for.end7:                                         ; preds = %for.cond
63  ret void
64}
65