Skip to content

Commit 67f025a

Browse files
committed
Fix bugs introduced when merging.
1 parent 5536a2c commit 67f025a

File tree

5 files changed

+15
-33
lines changed

5 files changed

+15
-33
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ static void processHostEvalClauses(lower::AbstractConverter &converter,
419419
beginClauseList =
420420
&std::get<parser::OmpClauseList>(beginDirective.t);
421421

422-
// FIXME(JAN): For now we check if there is an inner
423-
// OpenMPLoopConstruct, and extract the size clause from there
422+
// For now we check if there is an inner OpenMPLoopConstruct, and
423+
// extract the size clause from there
424424
const auto &nestedOptional =
425425
std::get<std::optional<parser::NestedConstruct>>(
426426
ompConstruct.t);

flang/lib/Semantics/canonicalize-omp.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ class CanonicalizationOfOmp {
143143
"If a loop construct has been fully unrolled, it cannot then be tiled"_err_en_US,
144144
parser::ToUpperCaseLetters(dir.source.ToString()));
145145
};
146-
147146
nextIt = it;
148147
while (++nextIt != block.end()) {
149148
// Ignore compiler directives.
@@ -159,14 +158,16 @@ class CanonicalizationOfOmp {
159158
if (innerDir.v == llvm::omp::Directive::OMPD_tile) {
160159
auto &innerLoopVariant =
161160
std::get<std::optional<parser::NestedConstruct>>(loops.back()->t);
162-
auto &innerLoop =
163-
std::get<common::Indirection<parser::OpenMPLoopConstruct>>(
164-
innerLoopVariant.value());
165-
innerLoop = std::move(*innerOmpLoop);
166-
// Retrieveing the address so that DoConstruct or inner loop can be
167-
// set later.
168-
loops.push_back(&(innerLoop.value()));
169-
nextIt = block.erase(nextIt);
161+
if (innerLoopVariant.has_value()) {
162+
auto *innerLoop =
163+
std::get_if<common::Indirection<parser::OpenMPLoopConstruct>>(
164+
&(innerLoopVariant.value()));
165+
*innerLoop = std::move(*innerOmpLoop);
166+
// Retrieveing the address so that DoConstruct or inner loop can be
167+
// set later.
168+
loops.push_back(&(innerLoop->value()));
169+
nextIt = block.erase(nextIt);
170+
}
170171
}
171172
}
172173

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,8 @@ void OmpAttributeVisitor::PrivatizeAssociatedLoopIndexAndCheckLoopLevel(
21412141
std::get_if<common::Indirection<parser::OpenMPLoopConstruct>>(
21422142
innerMostNest)}) {
21432143
innerMostLoop = &(innerLoop->value());
2144-
}
2144+
} else
2145+
break;
21452146
}
21462147

21472148
if (innerMostNest) {

flang/test/Lower/OpenMP/nested-loop-transformation-construct01.f90

Lines changed: 0 additions & 20 deletions
This file was deleted.

flang/test/Lower/OpenMP/wsloop-tile.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
! RUN: bbc -fopenmp -fopenmp-version=51 -emit-hlfir %s -o - | FileCheck %s
44

5-
!CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "wsloop_tile"} {
5+
!CHECK-LABEL: func.func @_QQmain() attributes {fir.bindc_name = "WSLOOP_TILE"} {
66
program wsloop_tile
77
integer :: i, j, k
88
integer :: a, b, c

0 commit comments

Comments
 (0)