brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · f339332 Raw
74 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3;    void bar();4;    void foo(int *A, int *B, long int N, long int M) {5;      for (long int j = 0; j < M; ++j) {6;        bar();7;        for (long int i = 0; i < N; ++i)8;          A[i] += 1;9;        for (long int i = 0; i < N; ++i)10;          A[i] += 1;11;      }12;    }13;14; Test to check that the scop only counts loop depth for loops fully contained15; in the scop.16; CHECK: Max Loop Depth: 117target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"18 19define void @foo(ptr %A, ptr %B, i64 %N, i64 %M) {20entry:21  %cmp1 = icmp slt i64 0, %M22  br i1 %cmp1, label %for.body1, label %for.end123 24  for.body1:                                         ; preds = %entry, %for.inc125    %j.0 = phi i64 [ 0, %entry ], [ %j.next, %for.inc1 ]26    call void (...) @bar() #027    %cmp2 = icmp slt i64 0, %N28    br i1 %cmp2, label %for.body2, label %for.end229 30  for.body2:                                        ; preds = %for.body1, %for.inc231    %i.1 = phi i64 [ 0, %for.body1 ], [ %i.next.1, %for.inc2 ]32    %arrayidx = getelementptr inbounds i32, ptr %A, i64 %i.133    %tmp = load i32, ptr %arrayidx, align 434    %add = add nsw i32 %tmp, 135    store i32 %add, ptr %arrayidx, align 436    br label %for.inc237 38  for.inc2:                                          ; preds = %for.body239    %i.next.1 = add nuw nsw i64 %i.1, 140    %cmp3 = icmp slt i64 %i.next.1, %N41    br i1 %cmp3, label %for.body2, label %for.end242 43 44  for.end2:                                          ; preds = %for.inc2, %for.body145    %cmp4 = icmp slt i64 0, %N46    br i1 %cmp4, label %for.body3, label %for.end347 48  for.body3:					   ; preds = %for.end249    %i.2 = phi i64 [ 0, %for.end2 ], [ %i.next.2, %for.inc3 ]50    %arrayidx1 = getelementptr inbounds i32, ptr %A, i64 %i.251    %tmp1 = load i32, ptr %arrayidx1, align 452    %add1 = add nsw i32 %tmp1, 153    store i32 %add1, ptr %arrayidx1, align 454    br label %for.inc355 56  for.inc3:					  ; preds = %for.body357    %i.next.2 = add nuw nsw i64 %i.2, 158    %cmp5 = icmp slt i64 %i.next.2, %N59    br i1 %cmp5, label %for.body3, label %for.end360 61  for.end3:					  ; preds = %for.inc3, %for.end262    br label %for.inc163 64  for.inc1:					  ; preds = %for.end365    %j.next = add nuw nsw i64 %j.0, 166    %cmp6 = icmp slt i64 %j.next, %M67    br i1 %cmp6, label %for.body1, label %for.end168 69  for.end1:                                        ; preds = %entry, %for.inc170    ret void71  }72 73declare void @bar(...) #074