hanchenye-llvm-project/clang/test/CodeGenCoroutines
Eric Fiselier 8ed97272ab [coroutines] Fix application of NRVO to Coroutine "Gro" or return object.
Summary:
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.

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 `BuildReturnStmt` marks the Gro variable as a coroutine candidate.






Reviewers: rsmith, GorNishanov, nicholas

Reviewed By: GorNishanov

Subscribers: majnemer, cfe-commits

Differential Revision: https://reviews.llvm.org/D42343

llvm-svn: 324037
2018-02-01 23:47:54 +00:00
..
Inputs [coroutines] [NFC] Add tests for return_void, unhandled_exception and promise dtor 2017-05-24 14:19:48 +00:00
coro-alloc.cpp [coroutines] Fix application of NRVO to Coroutine "Gro" or return object. 2018-02-01 23:47:54 +00:00
coro-await-domination.cpp CGCleanup: (NFC) add another test for r304335 - Don't try to spill static allocas 2017-06-01 01:15:25 +00:00
coro-await.cpp [coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control transfer) 2017-08-25 04:46:54 +00:00
coro-builtins-err.c
coro-builtins.c [coroutines] Replace all coro.frame builtins with an SSA value of coro.begin 2017-05-23 03:46:59 +00:00
coro-cleanup.cpp [coroutines] Add emission of initial and final suspends 2017-05-23 05:04:01 +00:00
coro-dest-slot.cpp [coroutines] Promote cleanup.dest.slot allocas to registers to avoid storing it in the coroutine frame 2017-11-11 17:00:43 +00:00
coro-eh-cleanup.cpp [coroutines] Fix coro-eh-cleanup.cpp test 2017-05-22 22:41:28 +00:00
coro-gro-nrvo.cpp [coroutines] Fix application of NRVO to Coroutine "Gro" or return object. 2018-02-01 23:47:54 +00:00
coro-gro.cpp [coroutines] Implement correct GRO lifetime 2017-05-24 02:38:26 +00:00
coro-lambda.cpp [coroutines] Make generic lambda coroutines work 2017-05-24 15:44:57 +00:00
coro-params.cpp [coroutines] Pass coro func args to promise ctor 2018-01-24 22:15:42 +00:00
coro-promise-dtor.cpp [coroutines] [NFC] Add tests for return_void, unhandled_exception and promise dtor 2017-05-24 14:19:48 +00:00
coro-ret-void.cpp [coroutines] Evaluate the operand of void `co_return` expressions. 2017-07-31 07:48:13 +00:00
coro-return.cpp [coroutines] Add cleanup for compiler injected objects/allocations in coroutine body 2017-04-01 00:22:47 +00:00
coro-unhandled-exception.cpp [coroutines] [NFC] Add tests for return_void, unhandled_exception and promise dtor 2017-05-24 14:19:48 +00:00
microsoft-abi-operator-coawait.cpp