Skip to content

Commit c19666c

Browse files
committed
More changes addressing feedback
1 parent 8dd98bc commit c19666c

File tree

4 files changed

+32
-34
lines changed

4 files changed

+32
-34
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11666,15 +11666,14 @@ def err_omp_loop_var_dsa : Error<
1166611666
"loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
1166711667
def err_omp_not_canonical_loop : Error<
1166811668
"loop after '#pragma omp %0' is not in canonical form">;
11669-
def err_omp_not_a_loop_sequence : Error<
11669+
def err_omp_not_a_loop_sequence : Error<
1167011670
"statement after '#pragma omp %0' must be a loop sequence containing canonical loops or loop-generating constructs">;
1167111671
def err_omp_empty_loop_sequence : Error<
1167211672
"loop sequence after '#pragma omp %0' must contain at least 1 canonical loop or loop-generating construct">;
1167311673
def err_omp_invalid_looprange : Error<
11674-
"loop range in '#pragma omp %0' exceeds the number of available loops: "
11675-
"range end '%1' is greater than the total number of loops '%2'">;
11674+
"looprange clause selects loops from %1 to %2 but this exceeds the number of loops (%3) in the loop sequence">;
1167611675
def warn_omp_redundant_fusion : Warning<
11677-
"loop range in '#pragma omp %0' contains only a single loop, resulting in redundant fusion">,
11676+
"looprange clause selects a single loop, resulting in redundant fusion">,
1167811677
InGroup<OpenMPClauses>;
1167911678
def err_omp_not_for : Error<
1168011679
"%select{statement after '#pragma omp %1' must be a for loop|"

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15930,8 +15930,8 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
1593015930

1593115931
if (!ValidLoopRange(FirstVal, CountVal, LoopSeqSize)) {
1593215932
SemaRef.Diag(LRC->getFirstLoc(), diag::err_omp_invalid_looprange)
15933-
<< getOpenMPDirectiveName(OMPD_fuse) << (FirstVal + CountVal - 1)
15934-
<< LoopSeqSize;
15933+
<< getOpenMPDirectiveName(OMPD_fuse) << FirstVal
15934+
<< (FirstVal + CountVal - 1) << LoopSeqSize;
1593515935
return StmtError();
1593615936
}
1593715937

@@ -16038,7 +16038,7 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
1603816038

1603916039
// Firstly we need to update TransformIndex to match the begining of the
1604016040
// looprange section
16041-
for (unsigned int I = 0; I < FirstVal - 1; ++I) {
16041+
for (unsigned I : llvm::seq<unsigned>(FirstVal - 1)) {
1604216042
if (LoopCategories[I] == OMPLoopCategory::TransformSingleLoop)
1604316043
++TransformIndex;
1604416044
}

clang/test/OpenMP/fuse_messages.cpp

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
void func() {
44

55
// expected-error@+2 {{statement after '#pragma omp fuse' must be a loop sequence containing canonical loops or loop-generating constructs}}
6-
#pragma omp fuse
6+
#pragma omp fuse
77
;
88

99
// expected-error@+2 {{statement after '#pragma omp fuse' must be a for loop}}
10-
#pragma omp fuse
10+
#pragma omp fuse
1111
{int bar = 0;}
1212

1313
// expected-error@+4 {{statement after '#pragma omp fuse' must be a for loop}}
14-
#pragma omp fuse
14+
#pragma omp fuse
1515
{
1616
for(int i = 0; i < 10; ++i);
1717
int x = 2;
1818
}
1919

2020
// expected-error@+2 {{statement after '#pragma omp fuse' must be a loop sequence containing canonical loops or loop-generating constructs}}
21-
#pragma omp fuse
22-
#pragma omp for
21+
#pragma omp fuse
22+
#pragma omp for
2323
for (int i = 0; i < 7; ++i)
2424
;
2525

@@ -39,7 +39,7 @@ void func() {
3939

4040

4141
// expected-error@+1 {{unexpected OpenMP clause 'final' in directive '#pragma omp fuse'}}
42-
#pragma omp fuse final(0)
42+
#pragma omp fuse final(0)
4343
{
4444
for (int i = 0; i < 7; ++i)
4545
;
@@ -49,7 +49,7 @@ void func() {
4949

5050
//expected-error@+4 {{loop after '#pragma omp fuse' is not in canonical form}}
5151
//expected-error@+3 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
52-
#pragma omp fuse
52+
#pragma omp fuse
5353
{
5454
for(int i = 0; i < 10; i*=2) {
5555
;
@@ -58,25 +58,25 @@ void func() {
5858
}
5959

6060
//expected-error@+2 {{loop sequence after '#pragma omp fuse' must contain at least 1 canonical loop or loop-generating construct}}
61-
#pragma omp fuse
61+
#pragma omp fuse
6262
{}
6363

6464
//expected-error@+3 {{statement after '#pragma omp fuse' must be a for loop}}
65-
#pragma omp fuse
65+
#pragma omp fuse
6666
{
67-
#pragma omp unroll full
67+
#pragma omp unroll full
6868
for(int i = 0; i < 10; ++i);
69-
69+
7070
for(int j = 0; j < 10; ++j);
7171
}
7272

73-
//expected-warning@+2 {{loop range in '#pragma omp fuse' contains only a single loop, resulting in redundant fusion}}
73+
//expected-warning@+2 {{looprange clause selects a single loop, resulting in redundant fusion}}
7474
#pragma omp fuse
7575
{
7676
for(int i = 0; i < 10; ++i);
7777
}
7878

79-
//expected-warning@+1 {{loop range in '#pragma omp fuse' contains only a single loop, resulting in redundant fusion}}
79+
//expected-warning@+1 {{looprange clause selects a single loop, resulting in redundant fusion}}
8080
#pragma omp fuse looprange(1, 1)
8181
{
8282
for(int i = 0; i < 10; ++i);
@@ -99,23 +99,23 @@ void func() {
9999

100100
const int x = 1;
101101
constexpr int y = 4;
102-
//expected-error@+1 {{loop range in '#pragma omp fuse' exceeds the number of available loops: range end '4' is greater than the total number of loops '3'}}
102+
//expected-error@+1 {{looprange clause selects loops from 1 to 4 but this exceeds the number of loops (3) in the loop sequence}}
103103
#pragma omp fuse looprange(x,y)
104104
{
105105
for(int i = 0; i < 10; ++i);
106106
for(int j = 0; j < 100; ++j);
107107
for(int k = 0; k < 50; ++k);
108108
}
109109

110-
//expected-error@+1 {{loop range in '#pragma omp fuse' exceeds the number of available loops: range end '420' is greater than the total number of loops '3'}}
110+
//expected-error@+1 {{looprange clause selects loops from 1 to 420 but this exceeds the number of loops (3) in the loop sequence}}
111111
#pragma omp fuse looprange(1,420)
112112
{
113113
for(int i = 0; i < 10; ++i);
114114
for(int j = 0; j < 100; ++j);
115115
for(int k = 0; k < 50; ++k);
116116
}
117117

118-
//expected-error@+1 {{loop range in '#pragma omp fuse' exceeds the number of available loops: range end '6' is greater than the total number of loops '5'}}
118+
//expected-error@+1 {{looprange clause selects loops from 1 to 6 but this exceeds the number of loops (5) in the loop sequence}}
119119
#pragma omp fuse looprange(1,6)
120120
{
121121
for(int i = 0; i < 10; ++i);
@@ -130,21 +130,21 @@ void func() {
130130
}
131131
}
132132

133-
//expected-error@+1 {{loop range in '#pragma omp fuse' exceeds the number of available loops: range end '4' is greater than the total number of loops '3'}}
133+
//expected-error@+1 {{looprange clause selects loops from 2 to 4 but this exceeds the number of loops (3) in the loop sequence}}
134134
#pragma omp fuse looprange(2,3)
135135
{
136136
#pragma omp unroll partial(2)
137137
for(int i = 0; i < 10; ++i);
138-
138+
139139
#pragma omp reverse
140140
for(int j = 0; j < 10; ++j);
141141

142-
#pragma omp fuse
142+
#pragma omp fuse
143143
{
144144
{
145145
#pragma omp reverse
146146
for(int j = 0; j < 10; ++j);
147-
}
147+
}
148148
for(int k = 0; k < 50; ++k);
149149
}
150150
}
@@ -154,15 +154,15 @@ void func() {
154154
template <typename T>
155155
static void templated_func() {
156156

157-
//expected-warning@+1 {{loop range in '#pragma omp fuse' contains only a single loop, resulting in redundant fusion}}
157+
//expected-warning@+1 {{looprange clause selects a single loop, resulting in redundant fusion}}
158158
#pragma omp fuse looprange(2,1)
159159
{
160160
for(int i = 0; i < 10; ++i);
161161
for(int j = 0; j < 100; ++j);
162162
for(int k = 0; k < 50; ++k);
163163
}
164164

165-
//expected-error@+1 {{loop range in '#pragma omp fuse' exceeds the number of available loops: range end '5' is greater than the total number of loops '3'}}
165+
//expected-error@+1 {{looprange clause selects loops from 3 to 5 but this exceeds the number of loops (3) in the loop sequence}}
166166
#pragma omp fuse looprange(3,3)
167167
{
168168
for(int i = 0; i < 10; ++i);
@@ -172,10 +172,10 @@ static void templated_func() {
172172

173173
}
174174

175-
template <int V>
175+
template <int V>
176176
static void templated_func_value_dependent() {
177177

178-
//expected-warning@+1 {{loop range in '#pragma omp fuse' contains only a single loop, resulting in redundant fusion}}
178+
//expected-warning@+1 {{looprange clause selects a single loop, resulting in redundant fusion}}
179179
#pragma omp fuse looprange(V,1)
180180
{
181181
for(int i = 0; i < 10; ++i);
@@ -184,7 +184,7 @@ static void templated_func_value_dependent() {
184184
}
185185
}
186186

187-
template <typename T>
187+
template <typename T>
188188
static void templated_func_type_dependent() {
189189
constexpr T s = 1;
190190

@@ -205,7 +205,6 @@ void template_inst() {
205205
templated_func_value_dependent<1>();
206206
// expected-note@+1 {{in instantiation of function template specialization 'templated_func_type_dependent<int>' requested here}}
207207
templated_func_type_dependent<int>();
208-
209208
}
210209

211210

openmp/runtime/test/transform/fuse/parallel-wsloop-collapse-intfor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int main() {
2424
#endif /* HEADER */
2525

2626
// CHECK: do
27-
// CHECK: i=0 j=0
27+
// CHECK-NEXT: i=0 j=0
2828
// CHECK-NEXT: i=0 k=0
2929
// CHECK-NEXT: i=0 j=1
3030
// CHECK-NEXT: i=0 k=1

0 commit comments

Comments
 (0)