diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-05-03 00:41:18 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-05-03 00:41:18 +0000 |
commit | d78f92fbb26b388b30192dfa88fd614db35dbbad (patch) | |
tree | 3e07496fe683abf375a92778a2229b38ba7cfd55 /clang/lib/Parse/Parser.cpp | |
parent | e39ee215519e6189d56b345e21f2cee2ffeed3ab (diff) | |
download | bcm5719-llvm-d78f92fbb26b388b30192dfa88fd614db35dbbad.tar.gz bcm5719-llvm-d78f92fbb26b388b30192dfa88fd614db35dbbad.zip |
Rewrite NRVO determination. Track NRVO candidates on the parser Scope and apply the NRVO candidate flag to all possible NRVO candidates here, and remove the flags in computeNRVO or upon template instantiation. A variable now has NRVO applied if and only if every return statement in that scope returns that variable. This is nearly optimal.
Performs NRVO roughly 7% more often in a bootstrap build of clang. Patch co-authored by Richard Smith.
llvm-svn: 207890
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index b096f1c0cb7..521ac9b3a7e 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -365,8 +365,7 @@ void Parser::ExitScope() { // Inform the actions module that this scope is going away if there are any // decls in it. - if (!getCurScope()->decl_empty()) - Actions.ActOnPopScope(Tok.getLocation(), getCurScope()); + Actions.ActOnPopScope(Tok.getLocation(), getCurScope()); Scope *OldScope = getCurScope(); Actions.CurScope = OldScope->getParent(); |