[PATCH] D119792: [Clang] [P2025] Analyze only potential scopes for NRVO
Evgeny Shulgin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 14 15:48:45 PST 2022
Izaron added a comment.
Cases that show the difference (they're covered in tests, though do we need an AST test as well?):
X test(bool B) {
if (B) {
X y; // before: nrvo, after: nrvo (same)
return y;
}
X x; // before: no nrvo, after: nrvo (better)
return x;
}
X test(bool B) {
X x; // before: no nrvo, after: no nrvo (same)
if (B)
return x;
X y; // before: no nrvo, after: nrvo (better)
return y;
}
X test(bool A, bool B) {
{
{
X x; // before: nrvo, after: nrvo (same)
if (A)
return x;
}
X y; // before: no nrvo, after: nrvo (better)
if (B)
return y;
}
X z;
retur n z; // before: no nrvo, after: nrvo (better)
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119792/new/
https://reviews.llvm.org/D119792
More information about the cfe-commits
mailing list