rjmccall added inline comments.

================
Comment at: lib/CodeGen/CGCall.cpp:3861
                < Align.getQuantity()) ||
             (ArgInfo.getIndirectByVal() && (RVAddrSpace != ArgAddrSpace))) {
           // Create an aligned temporary, and copy to it.
----------------
yaxunl wrote:
> rjmccall wrote:
> > This should be comparing AST address spaces.
> The AST address space of RV cannot be obtained through 
> `CGFunctionInfo::const_arg_iterator it` and `it->type` since `it->type` takes 
> type of 
> 
> 
> ```
> ImplicitCastExpr 0x60a9ff0 <col:5> 'struct S':'struct S' <LValueToRValue>
>     `-DeclRefExpr 0x60a9f28 <col:5> '__global struct S':'__global struct S' 
> lvalue Var 0x607efb0
> ```
> 
> and the original addr space is lost due to LValueToRValue cast.
> 
> To get the AST addr space of RV, it seems I need to save the argument Expr in 
> CallArgList and get it from Expr.
> 
I think your last two comments are related.  I'm not sure why we haven't copied 
into a temporary here, and if we had, the assumption of LangAS::Default would 
be fine.  Would you mind doing the investigation there?


https://reviews.llvm.org/D34367



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

Reply via email to