llvm-project
56 строк · 1.6 Кб
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb -polly-process-unprofitable=false -polly-unprofitable-scalar-accs=false "-passes=scop(polly-prune-unprofitable)" -disable-output -stats < %s 2>&1 | FileCheck -match-full-lines %s
2; REQUIRES: asserts
3;
4; Skip this SCoP for having scalar dependencies between all statements,
5; but only after ScopInfo (because optimization passes using ScopInfo such
6; as DeLICM might remove these scalar dependencies).
7;
8; double x = 0;
9; for (int i = 0; i < n; i += 1)
10; for (int j = 0; j < m; j += 1) {
11; B[0] = x;
12; x = A[0];
13; }
14; return x;
15;
16define double @func(i32 %n, i32 %m, ptr noalias nonnull %A, ptr noalias nonnull %B) {
17entry:
18br label %outer.for
19
20outer.for:
21%outer.phi = phi double [0.0, %entry], [%inner.phi, %outer.inc]
22%i = phi i32 [0, %entry], [%i.inc, %outer.inc]
23%i.cmp = icmp slt i32 %i, %n
24br i1 %i.cmp, label %inner.for, label %outer.exit
25
26inner.for:
27%inner.phi = phi double [%outer.phi, %outer.for], [%load, %inner.inc]
28%j = phi i32 [0, %outer.for], [%j.inc, %inner.inc]
29%j.cmp = icmp slt i32 %j, %m
30br i1 %j.cmp, label %body, label %inner.exit
31
32body:
33store double %inner.phi, ptr %B
34%load = load double, ptr %A
35br label %inner.inc
36
37inner.inc:
38%j.inc = add nuw nsw i32 %j, 1
39br label %inner.for
40
41inner.exit:
42br label %outer.inc
43
44outer.inc:
45%i.inc = add nuw nsw i32 %i, 1
46br label %outer.for
47
48outer.exit:
49br label %return
50
51return:
52ret double %outer.phi
53}
54
55
56; CHECK: 1 polly-prune-unprofitable - Number of pruned SCoPs because it they cannot be optimized in a significant way
57