137 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3; Error blocks are skipped during SCoP detection. We skip them during4; SCoP formation too as they might contain instructions we can not handle.5; However statements / basic blocks that follow error blocks are modeled.6;7; void timer_start(void);8; void timer_stop(void);9; void kernel(int *A, int *B, int timeit, int N) {10;11; if (timeit) {12; timer_start();13; // split BB14; A[0] = 0; // Do not create a statement for this block15; }16;17; for (int i = 0; i < N; i++)18; A[i] += B[i];19;20; if (timeit) {21; timer_stop();22; if (invalid float branch) // Do not crash on the float branch23; timer_start();24; }25;26; for (int i = 0; i < N; i++)27; A[i] += B[i];28;29; if (timeit)30; timer_stop();31; }32;33; The assumed context should not be empty even though all statements are34; executed only if timeit != 0.35;36; CHECK: Region: %entry.split---%if.end.2037; CHECK: Assumed Context:38; CHECK-NEXT: [timeit, N] -> { : }39; CHECK: Invalid Context:40; CHECK-NEXT: [timeit, N] -> { : timeit < 0 or timeit > 0 }41; CHECK: Statements {42; CHECK-NOT: Stmt_if_then_split43; CHECK: Stmt_for_body44; CHECK: Stmt_for_body_945; CHECK: }46;47target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"48 49define void @kernel(ptr %A, ptr %B, i32 %timeit, i32 %N) {50entry:51 br label %entry.split52 53entry.split:54 %tobool = icmp eq i32 %timeit, 055 br i1 %tobool, label %for.cond.pre, label %if.then56 57if.then: ; preds = %entry58 call void @timer_start()59 br label %if.then.split60 61; Dead block if we assume if.then not to be executed because of the call62if.then.split: ; preds = %if.then63 store i32 0, ptr %A, align 464 br label %for.cond.pre65 66for.cond.pre:67 %tmp = sext i32 %N to i6468 br label %for.cond69 70for.cond: ; preds = %for.inc, %if.end71 %indvars.iv1 = phi i64 [ %indvars.iv.next2, %for.inc ], [ 0, %for.cond.pre ]72 %cmp = icmp slt i64 %indvars.iv1, %tmp73 br i1 %cmp, label %for.body, label %for.end74 75for.body: ; preds = %for.cond76 %arrayidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv177 %tmp3 = load i32, ptr %arrayidx, align 478 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv179 %tmp4 = load i32, ptr %arrayidx2, align 480 %add = add nsw i32 %tmp4, %tmp381 store i32 %add, ptr %arrayidx2, align 482 br label %for.inc83 84for.inc: ; preds = %for.body85 %indvars.iv.next2 = add nuw nsw i64 %indvars.iv1, 186 br label %for.cond87 88for.end: ; preds = %for.cond89 %tobool3 = icmp eq i32 %timeit, 090 br i1 %tobool3, label %if.end.5, label %if.then.491 92if.then.4: ; preds = %for.end93 call void @timer_stop()94 %na = fcmp one float 4.0, 5.095 br i1 %na, label %if.end.5, label %if.then.4.rem96 97if.then.4.rem: ; preds = %for.end98 call void @timer_start()99 br label %if.end.5100 101if.end.5: ; preds = %for.end, %if.then.4102 %tmp5 = sext i32 %N to i64103 br label %for.cond.7104 105for.cond.7: ; preds = %for.inc.15, %if.end.5106 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc.15 ], [ 0, %if.end.5 ]107 %cmp8 = icmp slt i64 %indvars.iv, %tmp5108 br i1 %cmp8, label %for.body.9, label %for.end.17109 110for.body.9: ; preds = %for.cond.7111 %arrayidx11 = getelementptr inbounds i32, ptr %B, i64 %indvars.iv112 %tmp6 = load i32, ptr %arrayidx11, align 4113 %arrayidx13 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv114 %tmp7 = load i32, ptr %arrayidx13, align 4115 %add14 = add nsw i32 %tmp7, %tmp6116 store i32 %add14, ptr %arrayidx13, align 4117 br label %for.inc.15118 119for.inc.15: ; preds = %for.body.9120 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1121 br label %for.cond.7122 123for.end.17: ; preds = %for.cond.7124 %tobool18 = icmp eq i32 %timeit, 0125 br i1 %tobool18, label %if.end.20, label %if.then.19126 127if.then.19: ; preds = %for.end.17128 call void @timer_stop()129 br label %if.end.20130 131if.end.20: ; preds = %for.end.17, %if.then.19132 ret void133}134 135declare void @timer_start()136declare void @timer_stop()137