Skip to content

Add debug info support for function arguments in async functions. #35028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2020

Conversation

adrian-prantl
Copy link
Contributor

This commit depends on changes to the coroutine-splitting pass in LLVM. Shadow
copies are also turned off for async function arguments, because they make it
impossible to track debug info during coroutine splitting. Instead we are
relying on LLVM's CoroSplit.cpp to emit shadow copies. The Swift frontend gives
CoroSplit license to move do this by describing the arguments using a
dbg.declare intrinsic, even though it points to chain of load/GEP/bitcase
instructions into the Swift context function argument.

rdar://71866936

// give CoroSplit.cpp license to emit a shadow copy for them pointing inside
// the Swift Context argument that is valid throughout the function.
auto &EntryBlock = BB->getParent()->getEntryBlock();
if (auto *InsertBefore = EntryBlock.getFirstNonPHIOrDbg())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be simplified using entryBlock.getFirstInsertionPt() ("Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI instruction.")?

DirectValue,
IndirectValue,
InCoroContext,
InCoroContextIndirect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total nitpick: wdyt of replacing {'InCoroContext', 'InCoroContextIndirect'} with {'CoroDirectValue' and 'CoroIndirectValue'}? Naming might feel a bit more similar that way. Another option might be an enum class, then you could spell 'IndirectionKind::Direct', 'IndirectionKind::CoroDirect' etc.

@adrian-prantl
Copy link
Contributor Author

@swift-ci test

This commit depends on changes to the coroutine-splitting pass in LLVM.  Shadow
copies are also turned off for async function arguments, because they make it
impossible to track debug info during coroutine splitting. Instead we are
relying on LLVM's CoroSplit.cpp to emit shadow copies. The Swift frontend gives
CoroSplit license to move do this by describing the arguments using a
dbg.declare intrinsic, even though it points to chain of load/GEP/bitcase
instructions into the Swift context function argument.

rdar://71866936
@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 0e6a0b8

@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit 9671dbf into swiftlang:main Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants