This is an archive of the discontinued LLVM Phabricator instance.

Fix thunks returning memptrs via sret by emitting also scalar return values directly in sret slot (PR39901)
ClosedPublic

Authored by hans on Dec 6 2018, 7:31 AM.

Details

Summary

Thunks that return member pointers via sret are broken due to using temporary storage for the return value on the stack, and then passing that pointer to a tail call, violating the rule that a tail call can't access allocas in the caller (see bug).

Since r90526 (Eli), we put aggregate return values directly in the sret slot, but this doesn't apply to member pointers which are considered scalar.

Maybe I'm missing something subtle, but why not always use the sret slot directly for indirect return values? This patch does that, fixing the thunks.
Please take a look.

Diff Detail

Repository
rL LLVM

Event Timeline

hans created this revision.Dec 6 2018, 7:31 AM
hans edited subscribers, added: cfe-commits; removed: llvm-commits.Dec 6 2018, 7:37 AM

-llvm-commits
+cfe-commits

rjmccall accepted this revision.Dec 6 2018, 10:19 AM

That seems reasonable.

This revision is now accepted and ready to land.Dec 6 2018, 10:19 AM
This revision was automatically updated to reflect the committed changes.