[ForwardOpTree] Use known array content analysis to forward load instructions.
[polly-mirror.git] / test / DeLICM / reject_loadafterstore.ll
blob9f1a05d5f3eadf4515d08f4da458225d5360e86a
1 ; RUN: opt %loadPolly -polly-delicm -analyze -pass-remarks-missed=polly-delicm < %s 2>&1 | FileCheck %s
3 ;    void func(double *A) {
4 ;      for (int j = 0; j < 2; j += 1) { /* outer */
5 ;        double phi = 0.0;
6 ;        for (int i = 0; i < 4; i += 1) /* reduction */
7 ;          phi += 4.2;
8 ;        A[j] = phi;
9 ;        (void)A[j];
10 ;      }
11 ;    }
13 define void @func(double* noalias nonnull %A) {
14 entry:
15   br label %outer.preheader
17 outer.preheader:
18   br label %outer.for
20 outer.for:
21   %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
22   %j.cmp = icmp slt i32 %j, 2
23   br i1 %j.cmp, label %reduction.preheader, label %outer.exit
26     reduction.preheader:
27       br label %reduction.for
29     reduction.for:
30       %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
31       %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]
32       %i.cmp = icmp slt i32 %i, 4
33       br i1 %i.cmp, label %body, label %reduction.exit
37         body:
38           %add = fadd double %phi, 4.2
39           br label %reduction.inc
43     reduction.inc:
44       %i.inc = add nuw nsw i32 %i, 1
45       br label %reduction.for
47     reduction.exit:
48       %A_idx = getelementptr inbounds double, double* %A, i32 %j
49       store double %phi, double* %A_idx
50       %dummy = load double, double* %A_idx
51       br label %outer.inc
55 outer.inc:
56   %j.inc = add nuw nsw i32 %j, 1
57   br label %outer.for
59 outer.exit:
60   br label %return
62 return:
63   ret void
67 ; CHECK: load after store of same element in same statement