[clang] [CIR] Wire AMDGPU into the call-convention lowering pass (PR #220197)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 15 04:10:42 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) {
----------------
skc7 wrote:
A plain pointer has no attribute and explicit `address_space(0)` keeps `target_address_space(0)`. Comparing the attributes would wrongly coerce the second form (`CIR/CodeGen/address-space.c` failed with attr comparision). So kept the numeric check and added a comment.
https://github.com/llvm/llvm-project/pull/220197
More information about the cfe-commits
mailing list