[llvm-branch-commits] [clang] [CIR] Attach MemorySpaceAttrInterface for Lang and Target specific AS attributes (PR #179073)

David Rivera via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Feb 1 08:03:44 PST 2026


================
@@ -2953,14 +2956,28 @@ std::unique_ptr<cir::LowerModule> prepareLowerModule(mlir::ModuleOp module) {
     return {};
   return cir::createLowerModule(module, rewriter);
 }
+static unsigned
+getNumericASFromCIRAS(mlir::ptr::MemorySpaceAttrInterface asAttr,
+                      [[maybe_unused]] cir::LowerModule *lowerModule) {
+  if (!asAttr)
+    return 0; // default AS
+  if (auto targetAddrSpaceAttr =
+          mlir::dyn_cast_if_present<cir::TargetAddressSpaceAttr>(asAttr))
+    return targetAddrSpaceAttr.getValue();
+
+  if (mlir::isa_and_present<cir::LangAddressSpaceAttr>(asAttr))
+    llvm_unreachable("lowering LangAddressSpaceAttr NYI");
----------------
RiverDave wrote:

Support for this is later provided on: https://github.com/llvm/llvm-project/pull/179084

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


More information about the llvm-branch-commits mailing list