brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · d45c32e Raw
117 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3; Allow the user to define function names that are treated as4; error functions and assumed not to be executed.5;6;    void timer_start(void);7;    void timer_stop(void);8;    void kernel(int *A, int *B, int timeit, int N) {9;10;      if (timeit)11;        timer_start();12;13;      for (int i = 0; i < N; i++)14;        A[i] += B[i];15;16;      if (timeit) {17;        timer_stop();18;        timer_start();19;      }20;21;      for (int i = 0; i < N; i++)22;        A[i] += B[i];23;24;      if (timeit)25;        timer_stop();26;    }27;28; CHECK:      Region: %for.cond---%if.end.2029; CHECK:      Assumed Context:30; CHECK-NEXT: [N, timeit] -> {  :  }31; CHECK:      Invalid Context:32; CHECK-NEXT: [N, timeit] -> {  : timeit < 0 or timeit > 0 }33; CHECK:      Statements {34; CHECK:        Stmt35; CHECK:        Stmt36; CHECK-NOT:    Stmt37; CHECK:      }38;39target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"40 41define void @kernel(ptr %A, ptr %B, i32 %timeit, i32 %N) {42entry:43  %tobool = icmp eq i32 %timeit, 044  br i1 %tobool, label %if.end, label %if.then45 46if.then:                                          ; preds = %entry47  call void @timer_start()48  br label %if.end49 50if.end:                                           ; preds = %entry, %if.then51  %tmp = sext i32 %N to i6452  br label %for.cond53 54for.cond:                                         ; preds = %for.inc, %if.end55  %indvars.iv1 = phi i64 [ %indvars.iv.next2, %for.inc ], [ 0, %if.end ]56  %cmp = icmp slt i64 %indvars.iv1, %tmp57  br i1 %cmp, label %for.body, label %for.end58 59for.body:                                         ; preds = %for.cond60  %arrayidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv161  %tmp3 = load i32, ptr %arrayidx, align 462  %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv163  %tmp4 = load i32, ptr %arrayidx2, align 464  %add = add nsw i32 %tmp4, %tmp365  store i32 %add, ptr %arrayidx2, align 466  br label %for.inc67 68for.inc:                                          ; preds = %for.body69  %indvars.iv.next2 = add nuw nsw i64 %indvars.iv1, 170  br label %for.cond71 72for.end:                                          ; preds = %for.cond73  %tobool3 = icmp eq i32 %timeit, 074  br i1 %tobool3, label %if.end.5, label %if.then.475 76if.then.4:                                        ; preds = %for.end77  call void @timer_stop()78  call void @timer_start()79  br label %if.end.580 81if.end.5:                                         ; preds = %for.end, %if.then.482  %tmp5 = sext i32 %N to i6483  br label %for.cond.784 85for.cond.7:                                       ; preds = %for.inc.15, %if.end.586  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc.15 ], [ 0, %if.end.5 ]87  %cmp8 = icmp slt i64 %indvars.iv, %tmp588  br i1 %cmp8, label %for.body.9, label %for.end.1789 90for.body.9:                                       ; preds = %for.cond.791  %arrayidx11 = getelementptr inbounds i32, ptr %B, i64 %indvars.iv92  %tmp6 = load i32, ptr %arrayidx11, align 493  %arrayidx13 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv94  %tmp7 = load i32, ptr %arrayidx13, align 495  %add14 = add nsw i32 %tmp7, %tmp696  store i32 %add14, ptr %arrayidx13, align 497  br label %for.inc.1598 99for.inc.15:                                       ; preds = %for.body.9100  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1101  br label %for.cond.7102 103for.end.17:                                       ; preds = %for.cond.7104  %tobool18 = icmp eq i32 %timeit, 0105  br i1 %tobool18, label %if.end.20, label %if.then.19106 107if.then.19:                                       ; preds = %for.end.17108  call void @timer_stop()109  br label %if.end.20110 111if.end.20:                                        ; preds = %for.end.17, %if.then.19112  ret void113}114 115declare void @timer_start()116declare void @timer_stop()117