1; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck -match-full-lines %s
2;
3; Combine two partial stores (with overlapping domains) into one.
4;
5; for (int j = 0; j < n; j += 1) {
6;   A[0] = 42.0;
7;   A[0] = 42.0;
8; }
9;
10define void @coalesce_overlapping(i32 %n, double* noalias nonnull %A) {
11entry:
12  br label %for
13
14for:
15  %j = phi i32 [0, %entry], [%j.inc, %inc]
16  %j.cmp = icmp slt i32 %j, %n
17  br i1 %j.cmp, label %body, label %exit
18
19    body:
20      store double 42.0, double* %A
21      store double 42.0, double* %A
22      br label %inc
23
24inc:
25  %j.inc = add nuw nsw i32 %j, 1
26  br label %for
27
28exit:
29  br label %return
30
31return:
32  ret void
33}
34
35
36; CHECK: Statistics {
37; CHECK:     Overwrites removed: 0
38; CHECK:     Partial writes coalesced: 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:            new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : n <= 2147483647 };
46; CHECK-NEXT: }
47