Skip to content

Fix the hash function for SILDebugScopes to handle the empty scopes #9461

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 3 commits into from
May 10, 2017

Conversation

adrian-prantl
Copy link
Contributor

This PR was created for the fix to rdar://problem/31926379.

  • Explanation: Swift stores inline information as part of Scopes, LLVM stores it as part of Locations. Commit 5ea2d13 introduced a DenseMap for caching the non-inlined portion of a scope and it used the scope's parent SILFunction as part of the hash. This caused a collision for LLVM-only artificial helper functions where the SILFunction is a nullptr. This patch fixes this problem by using the address of the SILDebugScope as a key if the parent function is nullptr.
  • Scope: The collision cause LLVM r302469+ to fail verification (I added the verifier check in the light of this problem) and cause corrupted DWARF output that crashes DWARF consumers on older versions of LLVM.
  • Radar: rdar://problem/31926379
    Risk: Low.
  • Testing: Run dwarfdump --verify or symbols on programs compiled with debug info.

To make cherry-picking conflict free, this PR also includes an NFC refactoring. Let me know if a small but conflicting patch is preferable.

Previously an import of a submodule would emit debug info for
importing the root module.

<rdar://problem/17260802>

(cherry picked from commit c2b14dc)
generated for artificial LLVM-only functions correctly.

This fixes an IR Verifier error that was introduced in LLVM r302576.
The bug itself was introduced together with the code in 5ea2d13.

<rdar://problem/31926379>

(cherry picked from commit e156646)
@adrian-prantl
Copy link
Contributor Author

@swift-ci please test

@adrian-prantl adrian-prantl merged commit bc57cbc into swiftlang:swift-4.0-branch May 10, 2017
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.

1 participant