yaxunl added inline comments.
================ Comment at: lib/CodeGen/CGCall.cpp:3505 + if (AS != LangAS::Default && AS != LangAS::opencl_private && + AS != CGM.getASTAllocaAddressSpace()) + Flag = CallArg::ByValArgNeedsCopy; ---------------- rjmccall wrote: > This is an odd condition. What are you really trying to express here? > Something about the IR address space that the AST address space maps to? > > The condition `AS != LangAS::Default` kills the optimization for all > practical purposes, by the way, so something does need to change here. > > I will note that if CallArg could take an LValue, neither this nor the > alignment check would be required here; they'd just be done by the > call-emission code. This checks if an indirect by val arg can omit the copying. If the arg is in alloca or default addr space, the backend is able to copy it, so no explicit copying is needed by clang. Otherwise we need clang to insert copying. I will try to replace Flag with LVal and see if it simplifies things. https://reviews.llvm.org/D34367 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits