1; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines
2;
3; Ensure we do not move instructions from region statements in case the
4; instruction to move loads from an array which is also written to from
5; within the region. This is necessary as complex region statements may prevent
6; us from detecting possible memory conflicts.
7;
8; for (int j = 0; j < n; j += 1) {
9; bodyA:
10;   double val = A[0];
11;   if (cond)
12;
13; bodyA_true:
14;     A[0] = 42;
15;
16; bodyB:
17;     A[0] = val;
18; }
19;
20define void @func(i32 %n, double* noalias nonnull %A) {
21entry:
22  br label %for
23
24for:
25  %j = phi i32 [0, %entry], [%j.inc, %inc]
26  %j.cmp = icmp slt i32 %j, %n
27  br i1 %j.cmp, label %bodyA, label %exit
28
29    bodyA:
30      %val = load double, double* %A
31      %cond = fcmp oeq double 21.0, 21.0
32      br i1 %cond, label %bodyA_true, label %bodyB
33
34    bodyA_true:
35      store double 42.0, double* %A
36      br label %bodyB
37
38    bodyB:
39      store double %val, double* %A
40      br label %bodyB_exit
41
42    bodyB_exit:
43      br label %inc
44
45inc:
46  %j.inc = add nuw nsw i32 %j, 1
47  br label %for
48
49exit:
50  br label %return
51
52return:
53  ret void
54}
55
56; CHECK: ForwardOpTree executed, but did not modify anything
57