AlexVlx added a comment.

In D150746#4350288 <https://reviews.llvm.org/D150746#4350288>, @efriedma wrote:

> At first glance, this seems like the wrong place to put this cast.  If an 
> expression in the AST produces a pointer with generic pointer type, then 
> CodeGen should generate code for that expression that returns a generic 
> pointer type.  We shouldn't wait until the pointer is used to force a cast to 
> the correct type.

Thanks for the feedback. I believe what is going on is that for something like 
HIP, unless one goes outside of the language / touches builtins or intrinsics, 
one will never obtain anything but generic pointers as functiona arguments. 
However, it is possible to bind e.g. a global (the VTT case I mentioned), and 
we emit those in the global address space, so there's a bit of impedance 
mismatch for lack of a better word. I guess two alternative approaches here 
could be either: a) hoist the cast into `GetVTTParameter`, so that the GEP is 
formed over a casted pointer; b) modify `buildStructorSignature` so that it 
inserts VTT as a pointer to a pointer to void* in the target's GlobalAS. Seems 
like the latter is closer to the spirit of what is being suggested, unless I'm 
reading you wrong?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150746/new/

https://reviews.llvm.org/D150746

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to