Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Some minor changes to get an vec multiply via func example working un…
Browse files Browse the repository at this point in the history
…fortunately in areas that will be defunct soon
  • Loading branch information
agozillon committed Oct 6, 2023
1 parent 25d5b93 commit b11ccfb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
14 changes: 11 additions & 3 deletions flang/lib/Lower/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2515,7 +2515,9 @@ void Fortran::lower::genImplicitMapsForTarget(
mlir::getUsedValuesDefinedAbove(tarOp.getRegion(), operandSet);

// filter out uses already being mapped (explicit maps)
for (auto value : operandSet) {
bool removed = false;
for (llvm::SetVector<mlir::Value>::iterator iter = operandSet.begin();
iter != operandSet.end();) {
for (auto mapValue : tarOp.getMapOperands()) {
if (auto mapOp = mlir::dyn_cast_if_present<mlir::omp::MapInfoOp>(
mapValue.getDefiningOp())) {
Expand All @@ -2532,11 +2534,17 @@ void Fortran::lower::genImplicitMapsForTarget(
}
}

if (underlyingValue == value) {
operandSet.remove(value);
if (underlyingValue == *iter) {
iter = operandSet.erase(iter);
removed = true;
break;
}
}
}
if (!removed)
iter++;
else
removed = false;
}

// TODO: All captures are target_param, but not all are literal
Expand Down
12 changes: 11 additions & 1 deletion flang/lib/Optimizer/Transforms/OMPEarlyOutlining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,17 @@ class OMPEarlyOutliningPass
llvm::SetVector<mlir::Value> inputs;
mlir::Region &targetRegion = targetOp.getRegion();
mlir::getUsedValuesDefinedAbove(targetRegion, inputs);


// Collect all map info, even non-used maps must be collected to avoid
// ICEs.
for (mlir::Value oper : targetOp->getOperands()) {
if (auto mapEntry =
mlir::dyn_cast<mlir::omp::MapInfoOp>(oper.getDefiningOp())) {
if (!inputs.contains(mapEntry.getVarPtr()))
inputs.insert(mapEntry.getVarPtr());
}
}

// filter out declareTarget and map entries which are specially handled
// at the moment, so we do not wish these to end up as function arguments
// which would just be more noise in the IR.
Expand Down

0 comments on commit b11ccfb

Please sign in to comment.