llvm-project
48 строк · 1.2 Кб
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; Combine 3 partial accesses into one.
4;
5; for (int j = 0; j < n; j += 1) {
6; A[0] = 42.0;
7; A[0] = 42.0;
8; A[0] = 42.0;
9; }
10;
11define void @coalesce_3partials(i32 %n, ptr noalias nonnull %A) {
12entry:
13br label %for
14
15for:
16%j = phi i32 [0, %entry], [%j.inc, %inc]
17%j.cmp = icmp slt i32 %j, %n
18br i1 %j.cmp, label %body, label %exit
19
20body:
21store double 42.0, ptr %A
22store double 42.0, ptr %A
23store double 42.0, ptr %A
24br label %inc
25
26inc:
27%j.inc = add nuw nsw i32 %j, 1
28br label %for
29
30exit:
31br label %return
32
33return:
34ret void
35}
36
37
38; CHECK: Statistics {
39; CHECK: Overwrites removed: 0
40; CHECK: Partial writes coalesced: 2
41; CHECK: }
42
43; CHECK: After accesses {
44; CHECK-NEXT: Stmt_body
45; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
46; CHECK-NEXT: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
47; CHECK-NEXT: new: [n] -> { Stmt_body[i0] -> MemRef_A[0] };
48; CHECK-NEXT: }
49