1; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines
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;
18define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
19entry:
20  br label %for
21
22for:
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:
28      %B_idx = getelementptr inbounds double, double* %B, i32 %j
29      %val = load double, double* %B_idx
30      %cond = icmp slt i32 %j, 1
31      br i1 %cond, label %bodyA_true, label %bodyB
32
33    bodyA_true:
34      store double 0.0, double* %B_idx
35      br label %bodyB
36
37    bodyB:
38      %A_idx = getelementptr inbounds double, double* %A, i32 %j
39      store double %val, double* %A_idx
40      br label %inc
41
42inc:
43  %j.inc = add nuw nsw i32 %j, 1
44  br label %for
45
46exit:
47  br label %return
48
49return:
50  ret void
51}
52
53
54; CHECK: ForwardOpTree executed, but did not modify anything
55