================
@@ -379,8 +379,11 @@ static mlir::Type abiTypeToCIR(const llvm::abi::Type *ty, 
MLIRContext *ctx) {
       .Case([&](const llvm::abi::FloatType *fltTy) {
         return cir::getFloatingPointType(*fltTy->getSemantics(), ctx);
       })
-      .Case([&](const llvm::abi::PointerType *) {
-        return cir::PointerType::get(cir::VoidType::get(ctx));
+      .Case([&](const llvm::abi::PointerType *ptrTy) {
+        mlir::ptr::MemorySpaceAttrInterface addrSpace;
+        if (unsigned as = ptrTy->getAddrSpace())
+          addrSpace = cir::TargetAddressSpaceAttr::get(ctx, as);
+        return cir::PointerType::get(cir::VoidType::get(ctx), addrSpace);
----------------
steffenlarsen wrote:

I believe we can consider the address space of the pointer valid always.

```suggestion
        return cir::PointerType::get(cir::VoidType::get(ctx), 
ptrTy->getAddrSpace());
```

https://github.com/llvm/llvm-project/pull/220197
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to