1; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck -match-full-lines %s
2;
3; Remove identical writes
4; (two stores in the same statement that write the same value to the same
5; destination)
6;
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;
13; user:
14;   A[0] = A[1];
15; }
16;
17define void @overwritten_scalar(i32 %n, double* noalias nonnull %A) {
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 %body, label %exit
25
26    body:
27      %val = fadd double 21.0, 21.0
28      br label %user
29
30    user:
31      %phi = phi double [%val, %body]
32      %add = fadd double %val, %phi
33      store double %add, double* %A
34      br label %inc
35
36inc:
37  %j.inc = add nuw nsw i32 %j, 1
38  br label %for
39
40exit:
41  br label %return
42
43return:
44  ret void
45}
46
47
48; CHECK: Statistics {
49; CHECK:     Overwrites removed: 1
50; CHECK: }
51
52; CHECK:      Stmt_body
53; CHECK-NEXT:     MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]
54; CHECK-NEXT:            [n] -> { Stmt_body[i0] ->  MemRef_val[] };
55; CHECK-NEXT:       new: [n] -> { Stmt_body[i0] -> MemRef_A[1] };
56; CHECK-NEXT: Stmt_user
57