1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s 2; RUN: opt %loadPolly -polly-ast -analyze < %s | FileCheck %s --check-prefix=AST 3; 4; This only works after the post-dominator tree has fixed. 5; XFAIL: * 6; 7; void exception() __attribute__((noreturn)); 8; 9; void foo(long n, float A[100]) { 10; for (long j = 0; j < n; j++) { 11; for (long i = j; i < n; i++) { 12; if (i < 0) 13; exception(); 14; 15; if (i >= 100) 16; exception(); 17; 18; A[i] += i; 19; } 20; } 21; } 22; 23; CHECK: Assumed Context: 24; CHECK: [n] -> { : n >= 101 } 25 26; AST: if (1 && 0 == n >= 101) 27; AST: for (int c0 = 0; c0 < n; c0 += 1) 28; AST: for (int c1 = 0; c1 < n - c0; c1 += 1) 29; AST: Stmt_if_end_7(c0, c1); 30; 31; AST-NOT: for 32; AST-NOT: Stmt 33; 34; AST: else 35; AST: { /* original code */ } 36target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 37 38define void @foo(i64 %n, float* %A) #0 { 39entry: 40 br label %for.cond 41 42for.cond: ; preds = %for.inc.8, %entry 43 %j.0 = phi i64 [ 0, %entry ], [ %inc9, %for.inc.8 ] 44 %cmp = icmp slt i64 %j.0, %n 45 br i1 %cmp, label %for.body, label %for.end.10 46 47for.body: ; preds = %for.cond 48 br label %for.cond.1 49 50for.cond.1: ; preds = %for.inc, %for.body 51 %i.0 = phi i64 [ %j.0, %for.body ], [ %inc, %for.inc ] 52 %cmp2 = icmp slt i64 %i.0, %n 53 br i1 %cmp2, label %for.body.3, label %for.end 54 55for.body.3: ; preds = %for.cond.1 56 br i1 false, label %if.then, label %if.end 57 58if.then: ; preds = %for.body.3 59 call void (...) @exception() #2 60 unreachable 61 62if.end: ; preds = %for.body.3 63 %cmp5 = icmp sgt i64 %i.0, 99 64 br i1 %cmp5, label %if.then.6, label %if.end.7 65 66if.then.6: ; preds = %if.end 67 call void (...) @exception() #2 68 unreachable 69 70if.end.7: ; preds = %if.end 71 %conv = sitofp i64 %i.0 to float 72 %arrayidx = getelementptr inbounds float, float* %A, i64 %i.0 73 %tmp = load float, float* %arrayidx, align 4 74 %add = fadd float %tmp, %conv 75 store float %add, float* %arrayidx, align 4 76 br label %for.inc 77 78for.inc: ; preds = %if.end.7 79 %inc = add nuw nsw i64 %i.0, 1 80 br label %for.cond.1 81 82for.end: ; preds = %for.cond.1 83 br label %for.inc.8 84 85for.inc.8: ; preds = %for.end 86 %inc9 = add nuw nsw i64 %j.0, 1 87 br label %for.cond 88 89for.end.10: ; preds = %for.cond 90 ret void 91} 92 93declare void @exception(...) #1 94 95attributes #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" } 96attributes #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" } 97attributes #2 = { noreturn nounwind } 98 99!llvm.ident = !{!0} 100 101!0 = !{!"clang version 3.8.0 (trunk 246853)"} 102