[flang-commits] [flang] [flang] Emit `fir.global` in the global address space (PR #146653)

Matt Arsenault via flang-commits flang-commits at lists.llvm.org
Wed Jul 2 01:47:00 PDT 2025


================
@@ -1867,6 +1867,20 @@ fir::factory::deduceOptimalExtents(mlir::ValueRange extents1,
   return extents;
 }
 
+uint64_t fir::factory::getGlobalAddressSpace(mlir::DataLayout *dataLayout) {
+  if (dataLayout)
+    if (mlir::Attribute addrSpace = dataLayout->getGlobalMemorySpace())
+      return mlir::cast<mlir::IntegerAttr>(addrSpace).getUInt();
+  return 0;
----------------
arsenm wrote:

Why is there so much machinery? This should be direct read of constant 

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


More information about the flang-commits mailing list