[clang] [lld] [llvm] [mlir] [IR] Introduce `T<address space>` to `DataLayout` to represent flat address space if a target supports it (PR #108786)

Johannes Doerfert via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 24 03:48:08 PDT 2024


jdoerfert wrote:

> IIUC, the query 1) you were referring to was `Type::canLosslesslyBitCastTo`. If that's the case, it does nothing for AS cast.

I don't know what I was thinking of, the above or `CastInst::castIsValid`, neither is very helpful.

I am personally not opposed to the DL solution, but I guess it's a big change that feels too much for me to approve. I'm also worried the "flat" concept is a special case of something more generic and we should instead define that. E.g., 
- Does flat imply all AS can cast to it? If so, what happens if that is not true anymore in the future. If it's not implied, how do we query what's allowed and what is not?
- What about other AS casts that do not involve flat, we can't restrict them even if we introduce the flat idea in the DL, right?
- Is there a value in not defining 0 as flat? It's what we basically assume everywhere already, isn't it?


https://github.com/llvm/llvm-project/pull/108786


More information about the cfe-commits mailing list