Skip to content

Commit aa7a95c

Browse files
authored
[flang][OpenMP] Make function name more accurate, NFC (#172328)
Change `CountGeneratedLoops` to `CountGeneratedNests`, since it's really the nests that are counted.
1 parent 385f186 commit aa7a95c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

flang/lib/Semantics/check-omp-loop.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
namespace Fortran::semantics {
4141
static bool IsLoopTransforming(llvm::omp::Directive dir);
4242
static bool IsFullUnroll(const parser::OpenMPLoopConstruct &x);
43-
static std::optional<size_t> CountGeneratedLoops(
43+
static std::optional<size_t> CountGeneratedNests(
4444
const parser::ExecutionPartConstruct &epc);
45-
static std::optional<size_t> CountGeneratedLoops(const parser::Block &block);
45+
static std::optional<size_t> CountGeneratedNests(const parser::Block &block);
4646
} // namespace Fortran::semantics
4747

4848
namespace {
@@ -302,7 +302,7 @@ static bool IsFullUnroll(const parser::OpenMPLoopConstruct &x) {
302302
return false;
303303
}
304304

305-
static std::optional<size_t> CountGeneratedLoops(
305+
static std::optional<size_t> CountGeneratedNests(
306306
const parser::ExecutionPartConstruct &epc) {
307307
if (parser::Unwrap<parser::DoConstruct>(epc)) {
308308
return 1;
@@ -330,7 +330,7 @@ static std::optional<size_t> CountGeneratedLoops(
330330
if (!count || *count <= 0) {
331331
return std::nullopt;
332332
}
333-
if (auto nestedCount{CountGeneratedLoops(std::get<parser::Block>(omp.t))}) {
333+
if (auto nestedCount{CountGeneratedNests(std::get<parser::Block>(omp.t))}) {
334334
if (static_cast<size_t>(*count) <= *nestedCount)
335335
return 1 + *nestedCount - static_cast<size_t>(*count);
336336
}
@@ -341,7 +341,7 @@ static std::optional<size_t> CountGeneratedLoops(
341341
return 1;
342342
}
343343

344-
static std::optional<size_t> CountGeneratedLoops(const parser::Block &block) {
344+
static std::optional<size_t> CountGeneratedNests(const parser::Block &block) {
345345
// Count the number of loops in the associated block. If there are any
346346
// malformed construct in there, getting the number may be meaningless.
347347
// These issues will be diagnosed elsewhere, and we should not emit any
@@ -350,7 +350,7 @@ static std::optional<size_t> CountGeneratedLoops(const parser::Block &block) {
350350
// keep it that way.
351351
std::optional<size_t> numLoops{0};
352352
for (auto &epc : parser::omp::LoopRange(block)) {
353-
if (auto genCount{CountGeneratedLoops(epc)}) {
353+
if (auto genCount{CountGeneratedNests(epc)}) {
354354
*numLoops += *genCount;
355355
} else {
356356
numLoops = std::nullopt;
@@ -388,7 +388,7 @@ void OmpStructureChecker::CheckNestedConstruct(
388388

389389
// Check if a loop-nest-associated construct has only one top-level loop
390390
// in it.
391-
if (std::optional<size_t> numLoops{CountGeneratedLoops(body)}) {
391+
if (std::optional<size_t> numLoops{CountGeneratedNests(body)}) {
392392
if (*numLoops == 0) {
393393
context_.Say(beginSpec.DirName().source,
394394
"This construct should contain a DO-loop or a loop-nest-generating OpenMP construct"_err_en_US);
@@ -631,7 +631,7 @@ void OmpStructureChecker::CheckLooprangeBounds(
631631
return;
632632
}
633633
auto requiredCount{static_cast<size_t>(*first + *count - 1)};
634-
if (auto loopCount{CountGeneratedLoops(std::get<parser::Block>(x.t))}) {
634+
if (auto loopCount{CountGeneratedNests(std::get<parser::Block>(x.t))}) {
635635
if (*loopCount < requiredCount) {
636636
context_.Say(clause.source,
637637
"The specified loop range requires %zu loops, but the loop sequence has a length of %zu"_err_en_US,

0 commit comments

Comments
 (0)