xref: /llvm-project/polly/test/ForwardOpTree/noforward_load_writebetween.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly '-passes=print<polly-optree>' -disable-output < %s | FileCheck %s -match-full-lines
2;
3; Cannot rematerialize %val from B[0] at bodyC because B[0] has been
4; overwritten in bodyB.
5;
6; for (int j = 0; j < n; j += 1) {
7; bodyA:
8;   double val = B[j];
9;
10; bodyB:
11;   B[j] = 0.0;
12;
13; bodyC:
14;   A[j] = val;
15; }
16;
17define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {
18entry:
19  br label %for
20
21for:
22  %j = phi i32 [0, %entry], [%j.inc, %inc]
23  %j.cmp = icmp slt i32 %j, %n
24  br i1 %j.cmp, label %bodyA, label %exit
25
26    bodyA:
27      %B_idx = getelementptr inbounds double, ptr %B, i32 %j
28      %val = load double, ptr %B_idx
29      br label %bodyB
30
31    bodyB:
32      store double 0.0, ptr %B_idx
33      br label %bodyC
34
35    bodyC:
36      %A_idx = getelementptr inbounds double, ptr %A, i32 %j
37      store double %val, ptr %A_idx
38      br label %inc
39
40inc:
41  %j.inc = add nuw nsw i32 %j, 1
42  br label %for
43
44exit:
45  br label %return
46
47return:
48  ret void
49}
50
51
52; CHECK: ForwardOpTree executed, but did not modify anything
53