================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits