brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 5a49be8 Raw
87 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2; RUN: opt %loadNPMPolly '-passes=polly-custom<ast>' -polly-print-ast -disable-output < %s 2>&1 | FileCheck %s --check-prefix=AST3;4; The SCoP contains a loop with multiple exit blocks (BBs after leaving5; the loop). The current implementation of deriving their domain derives6; only a common domain for all of the exit blocks. We disabled loops with7; multiple exit blocks until this is fixed.8; XFAIL: *9;10;    void f(int *A, int *B, int N) {11;      for (int i = 0; i < N; i++) {12;        A[i]++;13;        switch (N) {14;        case 0:15;          B[i]++;16;          break;17;        default:18;          return;19;        }20;      }21;    }22 23; CHECK:      Statements {24; CHECK-NEXT:     Stmt_for_body25; CHECK-NEXT:         Domain :=26; CHECK-NEXT:             [N] -> { Stmt_for_body[0] : N > 0 };27; CHECK-NEXT:         Schedule :=28; CHECK-NEXT:             [N] -> { Stmt_for_body[i0] -> [0] };29; CHECK-NEXT:         ReadAccess :=    [Reduction Type: +] [Scalar: 0]30; CHECK-NEXT:             [N] -> { Stmt_for_body[i0] -> MemRef_A[0] };31; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: +] [Scalar: 0]32; CHECK-NEXT:             [N] -> { Stmt_for_body[i0] -> MemRef_A[0] };33; CHECK-NEXT: }34 35; AST:      if (1)36;37; AST:          if (N >= 1)38; AST-NEXT:       Stmt_for_body(0);39;40; AST:      else41; AST-NEXT:     {  /* original code */ }42 43target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"44 45define void @f(ptr %A, ptr %B, i32 %N) {46entry:47  %tmp = sext i32 %N to i6448  br label %for.cond49 50for.cond:                                         ; preds = %for.inc, %entry51  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]52  %cmp = icmp slt i64 %indvars.iv, %tmp53  br i1 %cmp, label %for.body, label %for.end.loopexit54 55for.body:                                         ; preds = %for.cond56  %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv57  %tmp1 = load i32, ptr %arrayidx, align 458  %inc = add nsw i32 %tmp1, 159  store i32 %inc, ptr %arrayidx, align 460  switch i32 %N, label %sw.default [61    i32 0, label %sw.bb62  ]63 64sw.bb:                                            ; preds = %for.body65  %arrayidx2 = getelementptr inbounds i32, ptr %B, i64 %indvars.iv66  %tmp2 = load i32, ptr %arrayidx2, align 467  %inc3 = add nsw i32 %tmp2, 168  store i32 %inc3, ptr %arrayidx2, align 469  br label %sw.epilog70 71sw.default:                                       ; preds = %for.body72  br label %for.end73 74sw.epilog:                                        ; preds = %sw.bb75  br label %for.inc76 77for.inc:                                          ; preds = %sw.epilog78  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 179  br label %for.cond80 81for.end.loopexit:                                 ; preds = %for.cond82  br label %for.end83 84for.end:                                          ; preds = %for.end.loopexit, %sw.default85  ret void86}87