[PATCH] D47671: [analyzer] Implement copy elision.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 11 13:30:32 PDT 2018


NoQ added a comment.

In https://reviews.llvm.org/D47671#1127486, @xazax.hun wrote:

> Just for the record, there is a common example where relying on copy elision might bite and google do not recommend relying on it for correctness: https://abseil.io/tips/120
>
> The main purpose of sharing is to add some more context to the discussion, I do not consider this to be an argument, because I can still see that this practice as opinionated.


Ah, NRVO, thanks for pointing it out! We can't do that yet, this patch only enables simple RVO. Also it seems that NRVO isn't mandatory even in C++17.

In any case, it's clear that relying on any sort of copy elision should be treated as a bug, but not necessarily a high-priority bug, and i'm not seeing any better way of detecting this bug other than suggesting the user to run a separate analysis with copy elision disabled and see if any of our usual kinds of bugs are found.

P.S. It seems that one of my currently-on-review patches has introduced a performance regression, i'm investigating it.


Repository:
  rC Clang

https://reviews.llvm.org/D47671





More information about the cfe-commits mailing list