[flang-commits] [flang] [OpenMP][Flang] Enable alias analysis inside omp target region (PR #111670)
Dominik Adamski via flang-commits
flang-commits at lists.llvm.org
Thu Oct 10 04:45:37 PDT 2024
================
@@ -319,6 +330,32 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v,
breakFromLoop = true;
})
.Case<hlfir::DeclareOp, fir::DeclareOp>([&](auto op) {
+ // If declare operation is inside omp target region,
+ // continue alias analysis outside the target region
+ if (llvm::isa<omp::TargetOp>(op->getParentOp())) {
+ omp::TargetOp targetOp =
+ llvm::cast<omp::TargetOp>(op->getParentOp());
+ auto mapClauseOwner =
+ llvm::dyn_cast<omp::MapClauseOwningOpInterface>(
+ targetOp.getOperation());
+ if (!mapClauseOwner) {
+ defOp = nullptr;
+ breakFromLoop = true;
+ return;
+ }
+ Block *targetEntryBlock = &targetOp->getRegion(0).front();
+ OperandRange mapVarsArr = mapClauseOwner.getMapVars();
+ assert(mapVarsArr.size() == targetEntryBlock->getNumArguments());
----------------
DominikAdamski wrote:
Thanks for detailed review. I modified the PR to adjust it to the @skatrak merged PR: https://github.com/llvm/llvm-project/pull/109808 .
I also added test case for OpenMP target data clause
https://github.com/llvm/llvm-project/pull/111670
More information about the flang-commits
mailing list