Skip to content

Commit 89f1ee4

Browse files
committed
Review comments
1 parent 57c6d14 commit 89f1ee4

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ getHostEvalInfoStackTop(lower::AbstractConverter &converter) {
215215
}
216216

217217
/// Stack frame for storing the OpenMPSectionsConstruct currently being
218-
/// processed so that it can be refered to when lowering the construct.
218+
/// processed so that it can be referred to when lowering the construct.
219219
class SectionsConstructStackFrame
220220
: public mlir::StateStackFrameBase<SectionsConstructStackFrame> {
221221
public:
@@ -1840,14 +1840,13 @@ static void genTargetClauses(
18401840
llvm::SmallVectorImpl<const semantics::Symbol *> &hasDeviceAddrSyms,
18411841
llvm::SmallVectorImpl<const semantics::Symbol *> &isDevicePtrSyms,
18421842
llvm::SmallVectorImpl<const semantics::Symbol *> &mapSyms) {
1843-
HostEvalInfo *hostEvalInfo = getHostEvalInfoStackTop(converter);
18441843
ClauseProcessor cp(converter, semaCtx, clauses);
18451844
cp.processBare(clauseOps);
18461845
cp.processDefaultMap(stmtCtx, defaultMaps);
18471846
cp.processDepend(symTable, stmtCtx, clauseOps);
18481847
cp.processDevice(stmtCtx, clauseOps);
18491848
cp.processHasDeviceAddr(stmtCtx, clauseOps, hasDeviceAddrSyms);
1850-
if (hostEvalInfo) {
1849+
if (HostEvalInfo *hostEvalInfo = getHostEvalInfoStackTop(converter)) {
18511850
// Only process host_eval if compiling for the host device.
18521851
processHostEvalClauses(converter, semaCtx, stmtCtx, eval, loc);
18531852
hostEvalInfo->collectValues(clauseOps.hostEvalVars);
@@ -2240,9 +2239,6 @@ genScanOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
22402239
converter.getCurrentLocation(), clauseOps);
22412240
}
22422241

2243-
/// This breaks the normal prototype of the gen*Op functions: adding the
2244-
/// sectionBlocks argument so that the enclosed section constructs can be
2245-
/// lowered here with correct reduction symbol remapping.
22462242
static mlir::omp::SectionsOp
22472243
genSectionsOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
22482244
semantics::SemanticsContext &semaCtx,
@@ -2251,11 +2247,10 @@ genSectionsOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
22512247
ConstructQueue::const_iterator item) {
22522248
const parser::OpenMPSectionsConstruct *sectionsConstruct =
22532249
getSectionsConstructStackTop(converter);
2254-
assert(sectionsConstruct);
2250+
assert(sectionsConstruct && "Missing additional parsing information");
22552251

22562252
const auto &sectionBlocks =
22572253
std::get<parser::OmpSectionBlocks>(sectionsConstruct->t);
2258-
converter.getStateStack().stackPop();
22592254
mlir::omp::SectionsOperands clauseOps;
22602255
llvm::SmallVector<const semantics::Symbol *> reductionSyms;
22612256
genSectionsClauses(converter, semaCtx, item->clauses, loc, clauseOps,
@@ -3810,8 +3805,8 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
38103805
buildConstructQueue(converter.getFirOpBuilder().getModule(), semaCtx,
38113806
eval, source, directive, clauses)};
38123807

3813-
converter.getStateStack().stackPush<SectionsConstructStackFrame>(
3814-
sectionsConstruct);
3808+
mlir::SaveStateStack<SectionsConstructStackFrame> saveStateStack{
3809+
converter.getStateStack(), sectionsConstruct};
38153810
genOMPDispatch(converter, symTable, semaCtx, eval, currentLocation, queue,
38163811
queue.begin());
38173812
}

0 commit comments

Comments
 (0)