[PATCH] D47586: Update NRVO logic to support early return (Attempt 2)

Taiju Tsuiki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 31 06:26:57 PDT 2018


tzik created this revision.
Herald added a subscriber: cfe-commits.

This is the second attempt of r333500 (Update NRVO logic to support early return).
The previous one was reverted for a miscompilation for an incorrect NRVO set up on templates such as:

  struct Foo {};
  
  template <typename T>
  T bar() {
    T t;
    if (false)
      return T();
    return t;
  }

Where, `t` is marked as non-NRVO variable before its instantiation. However, while its instantiation, it's left an NRVO candidate, turned into an NRVO variable later.


Repository:
  rC Clang

https://reviews.llvm.org/D47586

Files:
  include/clang/AST/Decl.h
  include/clang/Sema/Scope.h
  lib/Sema/Scope.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaStmt.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/CodeGenCXX/nrvo-noopt.cpp
  test/CodeGenCXX/nrvo.cpp
  test/SemaCXX/nrvo-ast.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47586.149278.patch
Type: text/x-patch
Size: 17473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180531/b4a75a21/attachment.bin>


More information about the cfe-commits mailing list