llvm-project
53 строки · 1.5 Кб
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-import-jscop,print<polly-simplify>' -polly-import-jscop-postfix=transformed -disable-output < %s | FileCheck -match-full-lines %s
2;
3; Do not combine stores if there is a read between them.
4; Note: The read between is unused, so will be removed by markAndSweep.
5; However, searches for coalesces takes place before.
6;
7; for (int j = 0; j < n; j += 1) {
8; A[0] = 42.0;
9; tmp = A[0];
10; A[0] = 42.0;
11; }
12;
13define void @nocoalesce_readbetween(i32 %n, ptr noalias nonnull %A) {
14entry:
15br label %for
16
17for:
18%j = phi i32 [0, %entry], [%j.inc, %inc]
19%j.cmp = icmp slt i32 %j, %n
20br i1 %j.cmp, label %body, label %exit
21
22body:
23store double 42.0, ptr %A
24%tmp = load double, ptr %A
25store double 42.0, ptr %A
26br label %inc
27
28inc:
29%j.inc = add nuw nsw i32 %j, 1
30br label %for
31
32exit:
33br label %return
34
35return:
36ret void
37}
38
39
40; CHECK: Statistics {
41; CHECK: Overwrites removed: 0
42; CHECK: Partial writes coalesced: 0
43; CHECK: }
44
45; CHECK: After accesses {
46; CHECK-NEXT: Stmt_body
47; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
48; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
49; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 >= 17 };
50; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
51; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
52; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] : i0 <= 16 };
53; CHECK-NEXT: }
54