[PATCH] D39562: [CodeGen][ObjC] Fix an assertion failure caused by copy elision
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 6 13:12:44 PST 2018
ahatanak added inline comments.
================
Comment at: lib/Sema/SemaPseudoObject.cpp:432
+ if (capturedRHS->getType()->getAsCXXRecordDecl() && capturedRHS->isRValue())
+ capturedRHS->setIsUnique();
+
----------------
rjmccall wrote:
> I think you can unconditionally set this here, actually. You just need to teach the other two exhaustive emitters in IRGen (scalar and complex) to look through unique OVEs. Plenty of other things in IRGen could benefit from being able to peephole through unique OVEs.
>
> Also, you can set it on the OVE for the base expression if this is a simple assignment or load.
All the builders created in checkPseudoObjectRValue and checkPseudoObjectAssignment (only when the assignment is simple) set the OVE's IsUnique bit to true.
https://reviews.llvm.org/D39562
More information about the cfe-commits
mailing list