[ForwardOpTree] Use known array content analysis to forward load instructions.
[polly-mirror.git] / test / ForwardOpTree / noforward_load_writebetween.ll
blobf4fc701fd82fa9dba0f65d63b43f752a1b7cf23f
1 ; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines
3 ; Cannot rematerialize %val from B[0] at bodyC because B[0] has been
4 ; overwritten in bodyB.
6 define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
7 entry:
8   br label %for
10 for:
11   %j = phi i32 [0, %entry], [%j.inc, %inc]
12   %j.cmp = icmp slt i32 %j, %n
13   br i1 %j.cmp, label %bodyA, label %exit
15     bodyA:
16       %B_idx = getelementptr inbounds double, double* %B, i32 %j
17       %val = load double, double* %B_idx
18       br label %bodyB
20     bodyB:
21       store double 0.0, double* %B_idx
22       br label %bodyC
24     bodyC:
25       %A_idx = getelementptr inbounds double, double* %A, i32 %j
26       store double %val, double* %A_idx
27       br label %inc
29 inc:
30   %j.inc = add nuw nsw i32 %j, 1
31   br label %for
33 exit:
34   br label %return
36 return:
37   ret void
41 ; CHECK: ForwardOpTree executed, but did not modify anything