1; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-print-simplify -disable-output < %s | FileCheck -match-full-lines %s
2; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb "-passes=scop(print<polly-simplify>)" -disable-output -aa-pipeline=basic-aa < %s | FileCheck -match-full-lines %s
3;
4; Remove a store that is overwritten by another store in the same statement.
5;
6; for (int j = 0; j < n; j += 1) {
7;   A[0] = 21.0;
8;   A[0] = 42.0;
9; }
10;
11define void @overwritten(i32 %n, double* noalias nonnull %A) {
12entry:
13  br label %for
14
15for:
16  %j = phi i32 [0, %entry], [%j.inc, %inc]
17  %j.cmp = icmp slt i32 %j, %n
18  br i1 %j.cmp, label %body, label %exit
19
20    body:
21      store double 21.0, double* %A
22      store double 42.0, double* %A
23      br label %inc
24
25inc:
26  %j.inc = add nuw nsw i32 %j, 1
27  br label %for
28
29exit:
30  br label %return
31
32return:
33  ret void
34}
35
36
37; CHECK: Statistics {
38; CHECK:     Overwrites removed: 1
39; CHECK: }
40
41; CHECK:      After accesses {
42; CHECK-NEXT:     Stmt_body
43; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
44; CHECK-NEXT:                 [n] -> { Stmt_body[i0] -> MemRef_A[0] };
45; CHECK-NEXT: }
46