Skip to content

Commit 52a71ea

Browse files
committed
Fix.
1 parent 5e7684e commit 52a71ea

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,19 +2533,13 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
25332533
loc, clauseOps, defaultMaps, hasDeviceAddrSyms,
25342534
isDevicePtrSyms, mapSyms);
25352535

2536-
DataSharingProcessor dsp(converter, semaCtx, item->clauses, eval,
2537-
/*shouldCollectPreDeterminedSymbols=*/
2538-
lower::omp::isLastItemInQueue(item, queue),
2539-
/*useDelayedPrivatization=*/true, symTable,
2540-
/*isTargetPrivitization=*/true);
2541-
dsp.processStep1(&clauseOps);
2542-
25432536
if (!isDevicePtrSyms.empty()) {
25442537
// is_device_ptr maps get duplicated so the clause and synthesized
25452538
// has_device_addr entry each own a unique MapInfoOp user, keeping
25462539
// MapInfoFinalization happy while still wiring the symbol into
25472540
// has_device_addr when the user didn’t spell it explicitly.
25482541
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
2542+
auto insertionPt = builder.saveInsertionPoint();
25492543
auto alreadyPresent = [&](const semantics::Symbol *sym) {
25502544
return llvm::any_of(hasDeviceAddrSyms, [&](const semantics::Symbol *s) {
25512545
return s && sym && s->GetUltimate() == sym->GetUltimate();
@@ -2571,8 +2565,16 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
25712565
assert(clonedMapInfo && "expected cloned map info op");
25722566
clauseOps.isDevicePtrVars[idx] = clonedMapInfo.getResult();
25732567
}
2568+
builder.restoreInsertionPoint(insertionPt);
25742569
}
25752570

2571+
DataSharingProcessor dsp(converter, semaCtx, item->clauses, eval,
2572+
/*shouldCollectPreDeterminedSymbols=*/
2573+
lower::omp::isLastItemInQueue(item, queue),
2574+
/*useDelayedPrivatization=*/true, symTable,
2575+
/*isTargetPrivitization=*/true);
2576+
dsp.processStep1(&clauseOps);
2577+
25762578
// 5.8.1 Implicit Data-Mapping Attribute Rules
25772579
// The following code follows the implicit data-mapping rules to map all the
25782580
// symbols used inside the region that do not have explicit data-environment

0 commit comments

Comments
 (0)