[PATCH] D42343: [coroutines] Fix application of NRVO to Coroutine "Gro" or return object.
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 20 19:19:13 PST 2018
EricWF created this revision.
EricWF added reviewers: rsmith, GorNishanov, nicholas.
Fix NRVO for Gro variable.
Previously, we only marked the GRO declaration as an NRVO variable
when its QualType and the function return's QualType matched exactly
(using operator==). However, this was incorrect for two reasons:
1. We were marking non-class types, such as ints, as being NRVO variables.
This was incorrect.
2. We failed to handle cases where the canonical types were the same, but
the actual `QualType` objects were different. For example, if one was represented by a typedef.
(Example: https://godbolt.org/g/3UFgsL)
This patch fixes these bugs by marking the Gro variable as supporting NRVO only
when `Sema::isCopyElisionCandidate` is true.
https://reviews.llvm.org/D42343
Files:
lib/Sema/SemaCoroutine.cpp
test/CodeGenCoroutines/coro-alloc.cpp
test/CodeGenCoroutines/coro-gro-nrvo.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42343.130791.patch
Type: text/x-patch
Size: 4227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180121/72dd2228/attachment.bin>
More information about the cfe-commits
mailing list