[ForwardOpTree] Use known array content analysis to forward load instructions.
[polly-mirror.git] / test / Simplify / overwritten_3phi.ll
blob1651437c189a3b35915406dbf1122721bda40e5e
1 ; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck -match-full-lines %s
3 ; Remove identical writes
4 ; (two stores in the same statement that write the same value to the same
5 ; destination)
7 ; for (int j = 0; j < n; j += 1) {
8 ; body:
9 ;   val = 21.0 + 21.0;
10 ;   A[1] = val;
11 ;   A[1] = val;
12 ;   A[1] = val;
14 ; user:
15 ;   A[0] = A[1];
16 ; }
18 define void @overwritten_3phi(i32 %n, double* noalias nonnull %A) {
19 entry:
20   br label %for
22 for:
23   %j = phi i32 [0, %entry], [%j.inc, %inc]
24   %j.cmp = icmp slt i32 %j, %n
25   br i1 %j.cmp, label %body, label %exit
27     body:
28       %val = fadd double 21.0, 21.0
29       br label %user
31     user:
32       %phi1 = phi double [%val, %body]
33       %phi2 = phi double [%val, %body]
34       %phi3 = phi double [%val, %body]
35       %add1 = fadd double %phi1, %phi2
36       %add2 = fadd double %add1, %phi3
37       store double %add2, double* %A
38       br label %inc
40 inc:
41   %j.inc = add nuw nsw i32 %j, 1
42   br label %for
44 exit:
45   br label %return
47 return:
48   ret void
53 ; CHECK: Statistics {
54 ; CHECK:     Overwrites removed: 2
55 ; CHECK: }
57 ; CHECK:      Stmt_body
58 ; CHECK-NEXT:         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]
59 ; CHECK-NEXT:             [n] -> { Stmt_body[i0] -> MemRef_phi3__phi[] };
60 ; CHECK-NEXT:        new: [n] -> { Stmt_body[i0] -> MemRef_A[1] };
61 ; CHECK-NEXT: Stmt_user