llvm-project
129 строк · 3.6 Кб
1; RUN: opt %loadNPMPolly -polly-only-func=f.*,g.* '-passes=print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s
2;
3; Check that the flag `-polly-only-func` works with regexes.
4;
5; CHECK: Function: f1
6; CHECK-NEXT: Region: %for.cond---%for.end
7;
8; CHECK: Function: f2
9; CHECK-NEXT: Region: %for.cond---%for.end
10;
11; CHECK: Function: g1
12; CHECK-NEXT: Region: %for.cond---%for.end
13;
14; CHECK-NOT: Function: h
15;
16; void f1(int* sum) {
17; for (int i = 0; i <= 100; i++)
18; sum += i * 3;
19; }
20; void f2(int* sum) {
21; for (int i = 0; i <= 100; i++)
22; sum += i * 3;
23; }
24; void g1(int* sum) {
25; for (int i = 0; i <= 100; i++)
26; sum += i * 3;
27; }
28; void h(int* sum) {
29; for (int i = 0; i <= 100; i++)
30; sum += i * 3;
31; }
32target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
33
34define void @f1(ptr %sum) {
35entry:
36br label %entry.split1
37
38entry.split1: ; preds = %entry
39br label %entry.split
40
41entry.split: ; preds = %entry.split1
42br label %for.cond
43
44for.cond: ; preds = %for.cond, %entry.split
45%i1.0 = phi i32 [ 0, %entry.split ], [ %inc, %for.cond ]
46%sum.reload = load i32, ptr %sum
47%mul = mul nsw i32 %i1.0, 3
48%add = add nsw i32 %sum.reload, %mul
49%inc = add nsw i32 %i1.0, 1
50store i32 %add, ptr %sum
51%cmp = icmp slt i32 %i1.0, 100
52br i1 %cmp, label %for.cond, label %for.end
53
54for.end: ; preds = %for.cond
55ret void
56}
57
58
59define void @f2(ptr %sum) {
60entry:
61br label %entry.split1
62
63entry.split1: ; preds = %entry
64br label %entry.split
65
66entry.split: ; preds = %entry.split1
67br label %for.cond
68
69for.cond: ; preds = %for.cond, %entry.split
70%i1.0 = phi i32 [ 0, %entry.split ], [ %inc, %for.cond ]
71%sum.reload = load i32, ptr %sum
72%mul = mul nsw i32 %i1.0, 3
73%add = add nsw i32 %sum.reload, %mul
74%inc = add nsw i32 %i1.0, 1
75store i32 %add, ptr %sum
76%cmp = icmp slt i32 %i1.0, 100
77br i1 %cmp, label %for.cond, label %for.end
78
79for.end: ; preds = %for.cond
80ret void
81}
82
83define void @g1(ptr %sum) {
84entry:
85br label %entry.split1
86
87entry.split1: ; preds = %entry
88br label %entry.split
89
90entry.split: ; preds = %entry.split1
91br label %for.cond
92
93for.cond: ; preds = %for.cond, %entry.split
94%i1.0 = phi i32 [ 0, %entry.split ], [ %inc, %for.cond ]
95%sum.reload = load i32, ptr %sum
96%mul = mul nsw i32 %i1.0, 3
97%add = add nsw i32 %sum.reload, %mul
98%inc = add nsw i32 %i1.0, 1
99store i32 %add, ptr %sum
100%cmp = icmp slt i32 %i1.0, 100
101br i1 %cmp, label %for.cond, label %for.end
102
103for.end: ; preds = %for.cond
104ret void
105}
106
107define void @h(ptr %sum) {
108entry:
109br label %entry.split1
110
111entry.split1: ; preds = %entry
112br label %entry.split
113
114entry.split: ; preds = %entry.split1
115br label %for.cond
116
117for.cond: ; preds = %for.cond, %entry.split
118%i1.0 = phi i32 [ 0, %entry.split ], [ %inc, %for.cond ]
119%sum.reload = load i32, ptr %sum
120%mul = mul nsw i32 %i1.0, 3
121%add = add nsw i32 %sum.reload, %mul
122%inc = add nsw i32 %i1.0, 1
123store i32 %add, ptr %sum
124%cmp = icmp slt i32 %i1.0, 100
125br i1 %cmp, label %for.cond, label %for.end
126
127for.end: ; preds = %for.cond
128ret void
129}
130
131