1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
3 ; Allow the user to define function names that are treated as
4 ; error functions and assumed not to be executed.
6 ; void timer_start(void);
7 ; void timer_stop(void);
8 ; void kernel(int *A, int *B, int timeit, int N) {
13 ; for (int i = 0; i < N; i++)
21 ; for (int i = 0; i < N; i++)
28 ; CHECK: Region: %for.cond---%if.end.20
29 ; CHECK: Assumed Context:
30 ; CHECK-NEXT: [N, timeit] -> { : }
31 ; CHECK: Invalid Context:
32 ; CHECK-NEXT: [N, timeit] -> { : timeit < 0 or timeit > 0 }
39 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
41 define void @kernel(ptr %A, ptr %B, i32 %timeit, i32 %N) {
43 %tobool = icmp eq i32 %timeit, 0
44 br i1 %tobool, label %if.end, label %if.then
46 if.then: ; preds = %entry
47 call void @timer_start()
50 if.end: ; preds = %entry, %if.then
51 %tmp = sext i32 %N to i64
54 for.cond: ; preds = %for.inc, %if.end
55 %indvars.iv1 = phi i64 [ %indvars.iv.next2, %for.inc ], [ 0, %if.end ]
56 %cmp = icmp slt i64 %indvars.iv1, %tmp
57 br i1 %cmp, label %for.body, label %for.end
59 for.body: ; preds = %for.cond
60 %arrayidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv1
61 %tmp3 = load i32, ptr %arrayidx, align 4
62 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv1
63 %tmp4 = load i32, ptr %arrayidx2, align 4
64 %add = add nsw i32 %tmp4, %tmp3
65 store i32 %add, ptr %arrayidx2, align 4
68 for.inc: ; preds = %for.body
69 %indvars.iv.next2 = add nuw nsw i64 %indvars.iv1, 1
72 for.end: ; preds = %for.cond
73 %tobool3 = icmp eq i32 %timeit, 0
74 br i1 %tobool3, label %if.end.5, label %if.then.4
76 if.then.4: ; preds = %for.end
77 call void @timer_stop()
78 call void @timer_start()
81 if.end.5: ; preds = %for.end, %if.then.4
82 %tmp5 = sext i32 %N to i64
85 for.cond.7: ; preds = %for.inc.15, %if.end.5
86 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc.15 ], [ 0, %if.end.5 ]
87 %cmp8 = icmp slt i64 %indvars.iv, %tmp5
88 br i1 %cmp8, label %for.body.9, label %for.end.17
90 for.body.9: ; preds = %for.cond.7
91 %arrayidx11 = getelementptr inbounds i32, ptr %B, i64 %indvars.iv
92 %tmp6 = load i32, ptr %arrayidx11, align 4
93 %arrayidx13 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
94 %tmp7 = load i32, ptr %arrayidx13, align 4
95 %add14 = add nsw i32 %tmp7, %tmp6
96 store i32 %add14, ptr %arrayidx13, align 4
99 for.inc.15: ; preds = %for.body.9
100 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
103 for.end.17: ; preds = %for.cond.7
104 %tobool18 = icmp eq i32 %timeit, 0
105 br i1 %tobool18, label %if.end.20, label %if.then.19
107 if.then.19: ; preds = %for.end.17
108 call void @timer_stop()
111 if.end.20: ; preds = %for.end.17, %if.then.19
115 declare void @timer_start()
116 declare void @timer_stop()