[flang] [llvm] [Flang][OpenMP] Add global address space to globals for target device (PR #119585)

Abid Qadeer via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 11:01:48 PST 2025


================
@@ -346,7 +346,10 @@ unsigned ConvertFIRToLLVMPattern::getAllocaAddressSpace(
   mlir::Operation *parentOp = rewriter.getInsertionBlock()->getParentOp();
   assert(parentOp != nullptr &&
          "expected insertion block to have parent operation");
-  if (auto module = parentOp->getParentOfType<mlir::ModuleOp>())
+  auto module = mlir::isa<mlir::ModuleOp>(parentOp)
+                    ? mlir::cast<mlir::ModuleOp>(parentOp)
+                    : parentOp->getParentOfType<mlir::ModuleOp>();
+  if (module)
----------------
abidh wrote:

This change and the one below is not exactly required for this PR. I guess they are small enough to include in this but could go in a separate PR.

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


More information about the llvm-commits mailing list