[clang] [CIR] Cast alloca for function parameter to the right address space (PR #220836)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 8 02:29:10 PDT 2026
================
@@ -488,6 +488,18 @@ void CIRGenFunction::emitFunctionProlog(const FunctionArgList &args,
convertType(paramVar->getType()), paramLoc, alignment,
/*insertIntoFnEntryBlock=*/true);
+ mlir::ptr::MemorySpaceAttrInterface srcAddrSpace =
+ getCIRAllocaAddressSpace();
+ mlir::ptr::MemorySpaceAttrInterface destAddrSpace =
+ cir::toCIRAddressSpaceAttr(getMLIRContext(),
+ paramVar->getType().getAddressSpace());
+ if (srcAddrSpace != destAddrSpace) {
+ mlir::Type destPtrTy = builder.getPointerTo(
+ (cast<cir::PointerType>(addrVal.getType())).getPointee(),
+ destAddrSpace);
+ addrVal = performAddrSpaceCast(addrVal, destPtrTy);
+ }
----------------
Fznamznon wrote:
Sure, why not
https://github.com/llvm/llvm-project/pull/220836
More information about the cfe-commits
mailing list