llvm-project
61 строка · 1.7 Кб
1; RUN: opt %loadNPMPolly '-passes=polly-import-jscop,print<polly-simplify>' -polly-import-jscop-postfix=transformed -disable-output < %s | FileCheck %s -match-full-lines
2;
3; Map %val to A[j], so the scalar write on Stmt_for_bodyB can be removed.
4;
5; for (int j = 0; j < n; j += 1) {
6; bodyA:
7; double val = 21.0 + 21.0;
8; A[j] = val;
9;
10; bodyB:
11; B[j] = val;
12; }
13;
14
15define void @sweep_mapped_value(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {
16entry:
17br label %for
18
19for:
20%j = phi i32 [0, %entry], [%j.inc, %inc]
21%j.cmp = icmp slt i32 %j, %n
22br i1 %j.cmp, label %bodyA, label %exit
23
24bodyA:
25%val = fadd double 21.0, 21.0
26%A_idx = getelementptr inbounds double, ptr %A, i32 %j
27store double %val, ptr %A_idx
28br label %bodyB
29
30bodyB:
31%B_idx = getelementptr inbounds double, ptr %B, i32 %j
32store double %val, ptr %B_idx
33br label %inc
34
35inc:
36%j.inc = add nuw nsw i32 %j, 1
37br label %for
38
39exit:
40br label %return
41
42return:
43ret void
44}
45
46
47; CHECK: Statistics {
48; CHECK: Dead accesses removed: 1
49; CHECK: }
50
51; CHECK: After accesses {
52; CHECK-NEXT: Stmt_bodyA
53; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
54; CHECK-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_A[i0] };
55; CHECK-NEXT: Stmt_bodyB
56; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
57; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_B[i0] };
58; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
59; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_val[] };
60; CHECK-NEXT: new: [n] -> { Stmt_bodyB[i0] -> MemRef_A[i0] };
61; CHECK-NEXT: }
62