brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 9034f75 Raw
98 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2; RUN: opt %loadNPMPolly '-passes=polly-custom<ast>' -polly-print-ast -disable-output < %s 2>&1 | FileCheck %s --check-prefix=AST3;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: for32; AST-NOT: Stmt33;34; AST: else35; AST:     {  /* original code */ }36target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"37 38define void @foo(i64 %n, ptr %A) {39entry:40  br label %for.cond41 42for.cond:                                         ; preds = %for.inc.8, %entry43  %j.0 = phi i64 [ 0, %entry ], [ %inc9, %for.inc.8 ]44  %cmp = icmp slt i64 %j.0, %n45  br i1 %cmp, label %for.body, label %for.end.1046 47for.body:                                         ; preds = %for.cond48  br label %for.cond.149 50for.cond.1:                                       ; preds = %for.inc, %for.body51  %i.0 = phi i64 [ %j.0, %for.body ], [ %inc, %for.inc ]52  %cmp2 = icmp slt i64 %i.0, %n53  br i1 %cmp2, label %for.body.3, label %for.end54 55for.body.3:                                       ; preds = %for.cond.156  br i1 false, label %if.then, label %if.end57 58if.then:                                          ; preds = %for.body.359  call void (...) @exception()60  unreachable61 62if.end:                                           ; preds = %for.body.363  %cmp5 = icmp sgt i64 %i.0, 9964  br i1 %cmp5, label %if.then.6, label %if.end.765 66if.then.6:                                        ; preds = %if.end67  call void (...) @exception()68  unreachable69 70if.end.7:                                         ; preds = %if.end71  %conv = sitofp i64 %i.0 to float72  %arrayidx = getelementptr inbounds float, ptr %A, i64 %i.073  %tmp = load float, ptr %arrayidx, align 474  %add = fadd float %tmp, %conv75  store float %add, ptr %arrayidx, align 476  br label %for.inc77 78for.inc:                                          ; preds = %if.end.779  %inc = add nuw nsw i64 %i.0, 180  br label %for.cond.181 82for.end:                                          ; preds = %for.cond.183  br label %for.inc.884 85for.inc.8:                                        ; preds = %for.end86  %inc9 = add nuw nsw i64 %j.0, 187  br label %for.cond88 89for.end.10:                                       ; preds = %for.cond90  ret void91}92 93declare void @exception(...)94 95!llvm.ident = !{!0}96 97!0 = !{!"clang version 3.8.0 (trunk 246853)"}98