[flang-commits] [flang] [OpenMP][Flang] Enable alias analysis inside omp target region (PR #111670)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Thu Oct 10 02:45:43 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());
----------------
tblah wrote:

nit: This can be written more efficiently as `if (auto targetOp = llvm::dyn_cast<omp::TargetOp>(op->getParentOp()))`. 

https://github.com/llvm/llvm-project/pull/111670


More information about the flang-commits mailing list