236
|
1 ; RUN: opt %loadPolly -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines
|
150
|
2 ;
|
|
3 ; B[j] is overwritten by at least one statement between the
|
|
4 ; definition of %val and its use. Hence, it cannot be forwarded.
|
|
5 ;
|
|
6 ; for (int j = 0; j < n; j += 1) {
|
|
7 ; bodyA:
|
|
8 ; double val = B[j];
|
|
9 ; if (j < 1) {
|
|
10 ; bodyA_true:
|
|
11 ; B[j] = 0.0;
|
|
12 ; }
|
|
13 ;
|
|
14 ; bodyB:
|
|
15 ; A[j] = val;
|
|
16 ; }
|
|
17 ;
|
252
|
18 define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {
|
150
|
19 entry:
|
|
20 br label %for
|
|
21
|
|
22 for:
|
|
23 %j = phi i32 [0, %entry], [%j.inc, %inc]
|
|
24 %j.cmp = icmp slt i32 %j, %n
|
|
25 br i1 %j.cmp, label %bodyA, label %exit
|
|
26
|
|
27 bodyA:
|
252
|
28 %B_idx = getelementptr inbounds double, ptr %B, i32 %j
|
|
29 %val = load double, ptr %B_idx
|
150
|
30 %cond = icmp slt i32 %j, 1
|
|
31 br i1 %cond, label %bodyA_true, label %bodyB
|
|
32
|
|
33 bodyA_true:
|
252
|
34 store double 0.0, ptr %B_idx
|
150
|
35 br label %bodyB
|
|
36
|
|
37 bodyB:
|
252
|
38 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
|
|
39 store double %val, ptr %A_idx
|
150
|
40 br label %inc
|
|
41
|
|
42 inc:
|
|
43 %j.inc = add nuw nsw i32 %j, 1
|
|
44 br label %for
|
|
45
|
|
46 exit:
|
|
47 br label %return
|
|
48
|
|
49 return:
|
|
50 ret void
|
|
51 }
|
|
52
|
|
53
|
|
54 ; CHECK: ForwardOpTree executed, but did not modify anything
|