[clang] [CIR] Wire AMDGPU into the call-convention lowering pass (PR #220197)
Steffen Larsen via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 14 05:55:11 PDT 2026
================
@@ -664,6 +668,26 @@ convertABIArgInfo(const llvm::abi::ArgInfo &info, MLIRContext *ctx,
// than emit a read of the wrong bytes.
if (offset && coerceIsRegisterTuple)
return std::nullopt;
+ // A pointer moved to another address space keeps its pointee, which
+ // abiTypeToCIR cannot recover.
+ if (auto origPtr = dyn_cast_if_present<cir::PointerType>(origTy)) {
+ if (const auto *coercePtr =
+ dyn_cast_if_present<llvm::abi::PointerType>(coerceAbi)) {
+ auto origAS = dyn_cast_if_present<cir::TargetAddressSpaceAttr>(
+ origPtr.getAddrSpace());
+ unsigned origASValue = origAS ? origAS.getValue() : 0;
+ if (!offset && coercePtr->getAddrSpace() != origASValue) {
----------------
steffenlarsen wrote:
I'm a little confused as to why we need to do the conversion into `origASValue` and not just pass `origPtr.getAddrSpace()` directly?
https://github.com/llvm/llvm-project/pull/220197
More information about the cfe-commits
mailing list