1 ; RUN: opt -loops -analyze < %s | FileCheck %s
3 ; void func(long n, double A[static const restrict 4*n], double B[static const restrict 4*n]) {
4 ; for (long i = 0; i < n; i += 1)
5 ; for (long j = 0; j < n; j += 1)
6 ; for (long k = 0; k < n; k += 1)
7 ; for (long l = 0; l < n; l += 1) {
8 ; A[i + j + k + l] = 21;
9 ; B[i + j + k + l] = 42;
13 ; Check that isAnnotatedParallel is working as expected.
15 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17 define void @func(i64 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
22 %i.0 = phi i64 [ 0, %entry ], [ %add28, %for.inc27 ]
23 %cmp = icmp slt i64 %i.0, %n
24 br i1 %cmp, label %for.cond2, label %for.end29
27 %j.0 = phi i64 [ %add25, %for.inc24 ], [ 0, %for.cond ]
28 %cmp3 = icmp slt i64 %j.0, %n
29 br i1 %cmp3, label %for.cond6, label %for.inc27
32 %k.0 = phi i64 [ %add22, %for.inc21 ], [ 0, %for.cond2 ]
33 %cmp7 = icmp slt i64 %k.0, %n
34 br i1 %cmp7, label %for.cond10, label %for.inc24
37 %l.0 = phi i64 [ %add20, %for.body13 ], [ 0, %for.cond6 ]
38 %cmp11 = icmp slt i64 %l.0, %n
39 br i1 %cmp11, label %for.body13, label %for.inc21
42 %add = add nuw nsw i64 %i.0, %j.0
43 %add14 = add nuw nsw i64 %add, %k.0
44 %add15 = add nuw nsw i64 %add14, %l.0
45 %arrayidx = getelementptr inbounds double, double* %A, i64 %add15
46 store double 2.100000e+01, double* %arrayidx, align 8, !llvm.access.group !5
47 %add16 = add nuw nsw i64 %i.0, %j.0
48 %add17 = add nuw nsw i64 %add16, %k.0
49 %add18 = add nuw nsw i64 %add17, %l.0
50 %arrayidx19 = getelementptr inbounds double, double* %B, i64 %add18
51 store double 4.200000e+01, double* %arrayidx19, align 8, !llvm.access.group !6
52 %add20 = add nuw nsw i64 %l.0, 1
53 br label %for.cond10, !llvm.loop !11
56 %add22 = add nuw nsw i64 %k.0, 1
57 br label %for.cond6, !llvm.loop !14
60 %add25 = add nuw nsw i64 %j.0, 1
61 br label %for.cond2, !llvm.loop !16
64 %add28 = add nuw nsw i64 %i.0, 1
65 br label %for.cond, !llvm.loop !18
81 !11 = distinct !{!11, !{!"llvm.loop.parallel_accesses", !10}}
82 !14 = distinct !{!14, !{!"llvm.loop.parallel_accesses", !8, !10}}
83 !16 = distinct !{!16, !{!"llvm.loop.parallel_accesses", !8}}
84 !18 = distinct !{!18, !{!"llvm.loop.parallel_accesses", !7}}
87 ; CHECK: Parallel Loop at depth 1
89 ; CHECK: Loop at depth 2
90 ; CHECK: Parallel Loop
91 ; CHECK: Parallel Loop