@@ -217,7 +217,7 @@ getHostEvalInfoStackTop(lower::AbstractConverter &converter) {
217217}
218218
219219// / Stack frame for storing the OpenMPSectionsConstruct currently being
220- // / processed so that it can be refered to when lowering the construct.
220+ // / processed so that it can be referred to when lowering the construct.
221221class SectionsConstructStackFrame
222222 : public mlir::StateStackFrameBase<SectionsConstructStackFrame> {
223223public:
@@ -1852,14 +1852,13 @@ static void genTargetClauses(
18521852 llvm::SmallVectorImpl<const semantics::Symbol *> &hasDeviceAddrSyms,
18531853 llvm::SmallVectorImpl<const semantics::Symbol *> &isDevicePtrSyms,
18541854 llvm::SmallVectorImpl<const semantics::Symbol *> &mapSyms) {
1855- HostEvalInfo *hostEvalInfo = getHostEvalInfoStackTop (converter);
18561855 ClauseProcessor cp (converter, semaCtx, clauses);
18571856 cp.processBare (clauseOps);
18581857 cp.processDefaultMap (stmtCtx, defaultMaps);
18591858 cp.processDepend (symTable, stmtCtx, clauseOps);
18601859 cp.processDevice (stmtCtx, clauseOps);
18611860 cp.processHasDeviceAddr (stmtCtx, clauseOps, hasDeviceAddrSyms);
1862- if (hostEvalInfo) {
1861+ if (HostEvalInfo * hostEvalInfo = getHostEvalInfoStackTop (converter) ) {
18631862 // Only process host_eval if compiling for the host device.
18641863 processHostEvalClauses (converter, semaCtx, stmtCtx, eval, loc);
18651864 hostEvalInfo->collectValues (clauseOps.hostEvalVars );
@@ -2251,9 +2250,6 @@ genScanOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
22512250 converter.getCurrentLocation (), clauseOps);
22522251}
22532252
2254- // / This breaks the normal prototype of the gen*Op functions: adding the
2255- // / sectionBlocks argument so that the enclosed section constructs can be
2256- // / lowered here with correct reduction symbol remapping.
22572253static mlir::omp::SectionsOp
22582254genSectionsOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
22592255 semantics::SemanticsContext &semaCtx,
@@ -2262,11 +2258,10 @@ genSectionsOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
22622258 ConstructQueue::const_iterator item) {
22632259 const parser::OpenMPSectionsConstruct *sectionsConstruct =
22642260 getSectionsConstructStackTop (converter);
2265- assert (sectionsConstruct);
2261+ assert (sectionsConstruct && " Missing additional parsing information " );
22662262
22672263 const auto §ionBlocks =
22682264 std::get<parser::OmpSectionBlocks>(sectionsConstruct->t );
2269- converter.getStateStack ().stackPop ();
22702265 mlir::omp::SectionsOperands clauseOps;
22712266 llvm::SmallVector<const semantics::Symbol *> reductionSyms;
22722267 genSectionsClauses (converter, semaCtx, item->clauses , loc, clauseOps,
@@ -4274,8 +4269,8 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
42744269 buildConstructQueue (converter.getFirOpBuilder ().getModule (), semaCtx,
42754270 eval, source, directive, clauses)};
42764271
4277- converter. getStateStack (). stackPush <SectionsConstructStackFrame>(
4278- sectionsConstruct) ;
4272+ mlir::SaveStateStack <SectionsConstructStackFrame> saveStateStack{
4273+ converter. getStateStack (), sectionsConstruct} ;
42794274 genOMPDispatch (converter, symTable, semaCtx, eval, currentLocation, queue,
42804275 queue.begin ());
42814276}
0 commit comments