llvm-project
49 строк · 882.0 Байт
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; Remove redundant scalar stores.
4;
5; for (int j = 0; j < n; j += 1) {
6; bodyA:
7; double val = A[0];
8;
9; bodyB:
10; A[0] = val;
11; }
12;
13define void @redundant_scalarwrite(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 %bodyA, label %exit
21
22
23bodyA:
24%val = load double, ptr %A
25br label %bodyB
26
27bodyB:
28store double %val, ptr %A
29br label %inc
30
31
32inc:
33%j.inc = add nuw nsw i32 %j, 1
34br label %for
35
36exit:
37br label %return
38
39return:
40ret void
41}
42
43
44; CHECK: Statistics {
45; CHECK: Redundant writes removed: 2
46; CHECK: }
47
48; CHECK: After accesses {
49; CHECK-NEXT: }
50