[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / polly / test / ScopInfo / BoundChecks / single-loop.ll
blobbc96c907afc9c8330eba8fe2b4c8730598446d9c
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.
6 ; XFAIL: *
8 ;    void exception() __attribute__((noreturn));
10 ;    void foo(long n, float A[100]) {
11 ;      for (long i = 0; i < n; i++) {
12 ;        if (i < 0)
13 ;          exception();
15 ;        if (i >= 100)
16 ;          exception();
18 ;        A[i] += i;
19 ;      }
20 ;    }
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);
32 ; AST-NOT: for
33 ; AST-NOT: Stmt
35 ; AST: else
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 {
42 entry:
43   br label %for.cond
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
55   unreachable
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
63   unreachable
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
71   br label %for.inc
73 for.inc:                                          ; preds = %if.end.4
74   %inc = add nuw nsw i64 %i.0, 1
75   br label %for.cond
77 for.end:                                          ; preds = %for.cond
78   ret void
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 }
88 !llvm.ident = !{!0}
90 !0 = !{!"clang version 3.8.0 (trunk 246853)"}