1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-print-ast -disable-output < %s | FileCheck %s --check-prefix=AST
4 ; This only works after the post-dominator tree has been fixed.
8 ; void exception() __attribute__((noreturn));
10 ; void foo(long n, float A[100]) {
11 ; for (long i = 0; i < n; i++) {
22 ; We should detect this kernel as a SCoP and derive run-time conditions such
23 ; that the bound-checked blocks are not part of the optimized SCoP.
25 ; CHECK: Invalid Context:
26 ; CHECK: [n] -> { : n >= 101 }
28 ; AST: if (1 && 0 == n >= 101)
29 ; AST: for (int c0 = 0; c0 < n; c0 += 1)
30 ; AST: Stmt_if_end_4(c0);
36 ; AST: { /* original code */ }
38 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
40 ; Function Attrs: nounwind uwtable
41 define void @foo(i64 %n, ptr %A) #0 {
45 for.cond: ; preds = %for.inc, %entry
46 %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
47 %cmp = icmp slt i64 %i.0, %n
48 br i1 %cmp, label %for.body, label %for.end
50 for.body: ; preds = %for.cond
51 br i1 false, label %if.then, label %if.end
53 if.then: ; preds = %for.body
54 call void (...) @exception() #2
57 if.end: ; preds = %for.body
58 %cmp2 = icmp sgt i64 %i.0, 99
59 br i1 %cmp2, label %if.then.3, label %if.end.4
61 if.then.3: ; preds = %if.end
62 call void (...) @exception() #2
65 if.end.4: ; preds = %if.end
66 %conv = sitofp i64 %i.0 to float
67 %arrayidx = getelementptr inbounds float, ptr %A, i64 %i.0
68 %tmp = load float, ptr %arrayidx, align 4
69 %add = fadd float %tmp, %conv
70 store float %add, ptr %arrayidx, align 4
73 for.inc: ; preds = %if.end.4
74 %inc = add nuw nsw i64 %i.0, 1
77 for.end: ; preds = %for.cond
81 ; Function Attrs: noreturn
82 declare void @exception(...) #1
84 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
85 attributes #1 = { noreturn "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
86 attributes #2 = { noreturn nounwind }
90 !0 = !{!"clang version 3.8.0 (trunk 246853)"}