This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Fix discarding non-primitive function call return values
ClosedPublic

Authored by tbaeder on Oct 21 2022, 8:35 AM.

Details

Summary

As briefly discussed in https://reviews.llvm.org/D136013

This creates a temporary local variable and puts the RVO pointer on the stack for the function to write the result into.

Diff Detail

Event Timeline

tbaeder created this revision.Oct 21 2022, 8:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2022, 8:35 AM
tbaeder requested review of this revision.Oct 21 2022, 8:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2022, 8:35 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
shafik added inline comments.Oct 24 2022, 2:13 PM
clang/lib/AST/Interp/ByteCodeExprGen.cpp
1158

Could you alternatively use Func->hasRVO()?

tbaeder marked an inline comment as done.Oct 25 2022, 12:39 AM
tbaeder added inline comments.
clang/lib/AST/Interp/ByteCodeExprGen.cpp
1158

I don't have to, but now that you mentioned it, that's much better since we won' t allocate the local for void return types... thanks!

tbaeder updated this revision to Diff 470392.Oct 25 2022, 12:40 AM
tbaeder marked an inline comment as done.
This revision is now accepted and ready to land.Nov 22 2022, 5:40 AM
This revision was landed with ongoing or failed builds.Nov 30 2022, 12:19 AM
This revision was automatically updated to reflect the committed changes.