| Tobias Grosser | 37eb422 | 2014-02-20 21:43:54 +0000 | [diff] [blame^] | 1 | ; RUN: opt -S %loadPolly -basicaa -polly-dependences-analysis-type=value-based -polly-ast -analyze < %s | FileCheck %s |
| 2 | ; RUN: opt -S %loadPolly -basicaa -polly-dependences-analysis-type=value-based -polly-dce-precision=full -polly-dce -polly-ast -analyze < %s | FileCheck %s -check-prefix=CHECK-DCE |
| 3 | target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" |
| 4 | target triple = "x86_64-pc-linux-gnu" |
| 5 | ; |
| 6 | ; for(i = 0; i < 200; i++ ) |
| 7 | ; A[i] = 2; |
| 8 | ; |
| 9 | ; for (i = 0; i < 50; i++ ) |
| 10 | ; A[i] = 5; |
| 11 | ; |
| 12 | ; for (i = 0; i < 70; i++ ) |
| 13 | ; A[i] = A[i] + 5; |
| 14 | ; |
| 15 | ; for (i = 100; i < 110; i++ ) |
| 16 | ; A[i] = i; |
| 17 | ; |
| 18 | define void @main() nounwind uwtable { |
| 19 | entry: |
| 20 | %A = alloca [200 x i32], align 16 |
| 21 | br label %for.body.1 |
| 22 | |
| 23 | for.body.1: |
| 24 | %indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %for.body.1 ] |
| 25 | %arrayidx.1 = getelementptr [200 x i32]* %A, i64 0, i64 %indvar.1 |
| 26 | store i32 2, i32* %arrayidx.1, align 4 |
| 27 | %indvar.next.1 = add i64 %indvar.1, 1 |
| 28 | %exitcond.1 = icmp ne i64 %indvar.next.1, 200 |
| 29 | br i1 %exitcond.1, label %for.body.1, label %exit.1 |
| 30 | |
| 31 | exit.1: |
| 32 | br label %for.body.2 |
| 33 | |
| 34 | for.body.2: |
| 35 | %indvar.2 = phi i64 [ 0, %exit.1 ], [ %indvar.next.2, %for.body.2 ] |
| 36 | %arrayidx.2 = getelementptr [200 x i32]* %A, i64 0, i64 %indvar.2 |
| 37 | store i32 5, i32* %arrayidx.2, align 4 |
| 38 | %indvar.next.2 = add i64 %indvar.2, 1 |
| 39 | %exitcond.2 = icmp ne i64 %indvar.next.2, 50 |
| 40 | br i1 %exitcond.2, label %for.body.2, label %exit.2 |
| 41 | |
| 42 | exit.2: |
| 43 | br label %for.body.3 |
| 44 | |
| 45 | for.body.3: |
| 46 | %indvar.3 = phi i64 [ 0, %exit.2 ], [ %indvar.next.3, %for.body.3 ] |
| 47 | %arrayidx.3 = getelementptr [200 x i32]* %A, i64 0, i64 %indvar.3 |
| 48 | %val = load i32* %arrayidx.3, align 4 |
| 49 | %add = add nsw i32 %val, 5 |
| 50 | store i32 %add, i32* %arrayidx.3, align 4 |
| 51 | %indvar.next.3 = add i64 %indvar.3, 1 |
| 52 | %exitcond.3 = icmp ne i64 %indvar.next.3, 70 |
| 53 | br i1 %exitcond.3, label %for.body.3 , label %exit.3 |
| 54 | |
| 55 | exit.3: |
| 56 | br label %for.body.4 |
| 57 | |
| 58 | for.body.4: |
| 59 | %indvar.4 = phi i64 [ 0, %exit.3 ], [ %indvar.next.4, %for.body.4 ] |
| 60 | %indvar.plus = add i64 %indvar.4, 100 |
| 61 | %trunc = trunc i64 %indvar.plus to i32 |
| 62 | %arrayidx.4 = getelementptr [200 x i32]* %A, i64 0, i64 %indvar.plus |
| 63 | store i32 %trunc, i32* %arrayidx.4, align 4 |
| 64 | %indvar.next.4 = add i64 %indvar.4, 1 |
| 65 | %exitcond.4 = icmp ne i64 %indvar.next.4, 10 |
| 66 | br i1 %exitcond.4, label %for.body.4, label %exit.4 |
| 67 | |
| 68 | exit.4: |
| 69 | ret void |
| 70 | } |
| 71 | |
| 72 | ; CHECK: for (int c1 = 0; c1 <= 199; c1 += 1) |
| 73 | ; CHECK: Stmt_for_body_1(c1); |
| 74 | ; CHECK: for (int c1 = 0; c1 <= 49; c1 += 1) |
| 75 | ; CHECK: Stmt_for_body_2(c1); |
| 76 | ; CHECK: for (int c1 = 0; c1 <= 69; c1 += 1) |
| 77 | ; CHECK: Stmt_for_body_3(c1); |
| 78 | ; CHECK: for (int c1 = 0; c1 <= 9; c1 += 1) |
| 79 | ; CHECK: Stmt_for_body_4(c1); |
| 80 | |
| 81 | ; CHECK-DCE: for (int c1 = 50; c1 <= 99; c1 += 1) |
| 82 | ; CHECK-DCE: Stmt_for_body_1(c1); |
| 83 | ; CHECK-DCE: for (int c1 = 110; c1 <= 199; c1 += 1) |
| 84 | ; CHECK-DCE: Stmt_for_body_1(c1); |
| 85 | ; CHECK-DCE: for (int c1 = 0; c1 <= 49; c1 += 1) |
| 86 | ; CHECK-DCE: Stmt_for_body_2(c1); |
| 87 | ; CHECK-DCE: for (int c1 = 0; c1 <= 69; c1 += 1) |
| 88 | ; CHECK-DCE: Stmt_for_body_3(c1); |
| 89 | ; CHECK-DCE: for (int c1 = 0; c1 <= 9; c1 += 1) |
| 90 | ; CHECK-DCE: Stmt_for_body_4(c1); |