brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 9d54a19 Raw
92 lines · plain
1; RUN: opt -passes='print<loops>' -disable-output %s 2>&1 | FileCheck %s2;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;10;         }11; }12;13; Check that isAnnotatedParallel is working as expected.14;15target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"16 17define void @func(i64 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {18entry:19  br label %for.cond20 21for.cond:22  %i.0 = phi i64 [ 0, %entry ], [ %add28, %for.inc27 ]23  %cmp = icmp slt i64 %i.0, %n24  br i1 %cmp, label %for.cond2, label %for.end2925 26for.cond2:27  %j.0 = phi i64 [ %add25, %for.inc24 ], [ 0, %for.cond ]28  %cmp3 = icmp slt i64 %j.0, %n29  br i1 %cmp3, label %for.cond6, label %for.inc2730 31for.cond6:32  %k.0 = phi i64 [ %add22, %for.inc21 ], [ 0, %for.cond2 ]33  %cmp7 = icmp slt i64 %k.0, %n34  br i1 %cmp7, label %for.cond10, label %for.inc2435 36for.cond10:37  %l.0 = phi i64 [ %add20, %for.body13 ], [ 0, %for.cond6 ]38  %cmp11 = icmp slt i64 %l.0, %n39  br i1 %cmp11, label %for.body13, label %for.inc2140 41for.body13:42  %add = add nuw nsw i64 %i.0, %j.043  %add14 = add nuw nsw i64 %add, %k.044  %add15 = add nuw nsw i64 %add14, %l.045  %arrayidx = getelementptr inbounds double, ptr %A, i64 %add1546  store double 2.100000e+01, ptr %arrayidx, align 8, !llvm.access.group !547  %add16 = add nuw nsw i64 %i.0, %j.048  %add17 = add nuw nsw i64 %add16, %k.049  %add18 = add nuw nsw i64 %add17, %l.050  %arrayidx19 = getelementptr inbounds double, ptr %B, i64 %add1851  store double 4.200000e+01, ptr %arrayidx19, align 8, !llvm.access.group !652  %add20 = add nuw nsw i64 %l.0, 153  br label %for.cond10, !llvm.loop !1154 55for.inc21:56  %add22 = add nuw nsw i64 %k.0, 157  br label %for.cond6, !llvm.loop !1458 59for.inc24:60  %add25 = add nuw nsw i64 %j.0, 161  br label %for.cond2, !llvm.loop !1662 63for.inc27:64  %add28 = add nuw nsw i64 %i.0, 165  br label %for.cond, !llvm.loop !1866 67for.end29:68  ret void69}70 71; access groups72!7 = distinct !{}73!8 = distinct !{}74!10 = distinct !{}75 76; access group lists77!5 = !{!7, !10}78!6 = !{!7, !8, !10}79 80; LoopIDs81!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}}85 86 87; CHECK: Parallel Loop at depth 188; CHECK-NOT: Parallel89; CHECK:     Loop at depth 290; CHECK:         Parallel Loop91; CHECK:             Parallel Loop92