20100720-MultipleConditions.ll
2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
; RUN: opt %loadPolly -polly-ast -analyze < %s
;int bar1();
;int bar2();
;int bar3();
;int k;
;#define N 100
;int A[N];
;
;int main() {
; int i, j, z;
;
; __sync_synchronize();
; for (i = 0; i < N; i++) {
; if (i < 50)
; A[i] = 8;
; if (i < 4)
; A[i] = 9;
; if (i < 3)
; A[i] = 10;
; }
; __sync_synchronize();
;
; return A[z];
;}
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"
@A = common global [100 x i32] zeroinitializer, align 16 ; <[100 x i32]*> [#uses=2]
@k = common global i32 0, align 4 ; <i32*> [#uses=0]
define i32 @main() nounwind {
; <label>:0
fence seq_cst
br label %1
; <label>:1 ; preds = %12, %0
%indvar = phi i64 [ %indvar.next, %12 ], [ 0, %0 ] ; <i64> [#uses=4]
%scevgep = getelementptr [100 x i32], [100 x i32]* @A, i64 0, i64 %indvar ; <i32*> [#uses=3]
%i.0 = trunc i64 %indvar to i32 ; <i32> [#uses=3]
%exitcond = icmp ne i64 %indvar, 100 ; <i1> [#uses=1]
br i1 %exitcond, label %2, label %13
; <label>:2 ; preds = %1
%3 = icmp slt i32 %i.0, 50 ; <i1> [#uses=1]
br i1 %3, label %4, label %5
; <label>:4 ; preds = %2
store i32 8, i32* %scevgep
br label %5
; <label>:5 ; preds = %4, %2
%6 = icmp slt i32 %i.0, 4 ; <i1> [#uses=1]
br i1 %6, label %7, label %8
; <label>:7 ; preds = %5
store i32 9, i32* %scevgep
br label %8
; <label>:8 ; preds = %7, %5
%9 = icmp slt i32 %i.0, 3 ; <i1> [#uses=1]
br i1 %9, label %10, label %11
; <label>:10 ; preds = %8
store i32 10, i32* %scevgep
br label %11
; <label>:11 ; preds = %10, %8
br label %12
; <label>:12 ; preds = %11
%indvar.next = add i64 %indvar, 1 ; <i64> [#uses=1]
br label %1
; <label>:13 ; preds = %1
fence seq_cst
%14 = sext i32 undef to i64 ; <i64> [#uses=1]
%15 = getelementptr inbounds i32, i32* getelementptr inbounds ([100 x i32], [100 x i32]* @A, i32 0, i32 0), i64 %14 ; <i32*> [#uses=1]
%16 = load i32, i32* %15 ; <i32> [#uses=1]
ret i32 %16
}
; CHECK: for (c2=0;c2<=2;c2++) {
; CHECK: S0(c2);
; CHECK: S1(c2);
; CHECK: S2(c2);
; CHECK: }
; CHECK: S0(3);
; CHECK: S1(3);
; CHECK: for (c2=4;c2<=49;c2++) {
; CHECK: S0(c2);
; CHECK: }
; CHECK: S0: Stmt_4
; CHECK: S1: Stmt_7
; CHECK: S2: Stmt_10