[PATCH] D46441: [clang][CodeGenCXX] Noalias attr for copy/move constructor arguments

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 12 22:11:53 PDT 2018


rsmith added a comment.

In https://reviews.llvm.org/D46441#1096874, @AntonBikineev wrote:

> Please notice, that this is not the only place where the position of the `this` pointer is assumed to always be first. As an example, another such place is here <https://clang.llvm.org/doxygen/CGCall_8cpp_source.html#l00293>.


Actually, that is just building the sequence of Clang types for the parameters. The mapping to LLVM arguments is still done via `ClangToLLVMArgMapping` when we build the LLVM IR function type. So at least that case is correct. I found this, which appears to be making a potentially-unsafe assumption: https://clang.llvm.org/doxygen/CGObjCGNU_8cpp_source.html#l00664 -- but almost all of CodeGen gets this right already.

>> I think this standard text is in error and UB would be appropriate, but we should at least discuss whether we want to take this additional liberty not technically granted by the standard.
> 
> Should we then file an issue to the Core?
>  BTW, gcc already performs this opt since 8.1: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899#c10

This seems like a pretty good argument for this being a wording defect. Yes, we should file a core issue.


https://reviews.llvm.org/D46441





More information about the cfe-commits mailing list