arsenm wrote:

> Both in InferAddressSpaces, and in Attributor, you don't really care about 
> whether a flat address-space exists. 

Right, this is more of an undesirable address space. Optimizations don't need 
to know anything about its behavior beyond that.


> In reply to your question above re whether this is a DL or a Target property, 
> I don't have a strong opinion there (it appears @shiltian and @arsenm might). 

I don't really like putting this in the DataLayout. My original idea was to 
move it to TargetMachine, but we want to avoid the dependence on CodeGen. The 
DataLayout is just the other place we have that defines module level target 
information. The simple solution is just have a switch over the target 
architecture in Attributor.

> I do believe that this is a necessary bit of query-able information, 
> especially from a Clang, for correctness reasons (more on that below).

I don't think this buys frontends much. Clang still needs to understand the 
full language address space -> target address space mapping. This would just 
allow populating one entry generically


> Ah, this is part of the challenge - we do indeed assume that 0 is flat, but 
> Targets aren't bound by LangRef to use 0 to denote flat (and some, like SPIR 
> / SPIR-V) do not

As I mentioned above, SPIRV can just work its way out of this problem for its 
IR. SPIR's only reason for existence is bitcode compatibility, so doing 
anything with there will be quite a lot of work which will never realistically 
happen. 


> I'm fine with adding the enforcement in LLVM that AS0 needs to be the flat 
> AS, if a target has it, but the definition of a flat AS still needs to be 
> set. If we do that, how will SPIR/SPIR-V work?
> This is the most generic wording I can come up with so far. Happy to hear 
> more feedbacks.

I would like to avoid adding additional special properties to AS0, or defining 
the flat concept. 



https://github.com/llvm/llvm-project/pull/108786
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to