[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
Thu Sep 19 23:08:09 PDT 2024


jdoerfert wrote:

> > +1 to @efriedma-quic and @jdoerfert's comments. DataLayout should remain as generic as possible. Trying to encode a concept of "_the_ flat address space" in it seems way too specific to one optimization for one or two targets.
> 
> This isn't purely a nice to have optimisation aid though, is it? There are cases where you need a safe (portable?) default that the target can perhaps optimise, but, absent that, would at least work, and at the moment there's no handy way to query that generically (or from Clang). We do handwave 0 as being that safe default, and hope for the best, but as mentioned that relies on targets using 0 to correspond to flat/generic/whatever we call it, which they are not bound to do. To me, adding this is not entirely different from encoding the Alloca AS, which we already do.

Your argument is my point 3), right? https://github.com/llvm/llvm-project/pull/108786#issuecomment-2357327866

Why is that a DL property and not just a target property? Or even just "computable" by asking query 1) for different ASs?

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


More information about the cfe-commits mailing list