Skip to content

[sil][debug-info] Refactor SILInstruction SILLocation verification out of SILVerifier onto a helper/use to verify in SILBuilder #37468

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 20, 2021

Conversation

gottesmm
Copy link
Contributor

This will ensure that we catch these issues earlier when they are introduced rather than after a pass that introduced the problem finished running (and we run the verifier).

@gottesmm gottesmm requested review from adrian-prantl and atrick May 17, 2021 23:16
@gottesmm gottesmm force-pushed the sil-debug-info-more-verification branch from 070bc44 to 7d60941 Compare May 17, 2021 23:26
@gottesmm
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7d609412a9adcfc5d0c24e99f953c4bdeaa0eab2

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7d609412a9adcfc5d0c24e99f953c4bdeaa0eab2

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -95,7 +95,7 @@ class SILDebugScope : public SILAllocated<SILDebugScope> {
};

/// Determine whether an instruction may not have a SILDebugScope.
bool maybeScopeless(SILInstruction &I);
bool maybeScopeless(const SILInstruction &inst);
Copy link
Contributor

Choose a reason for hiding this comment

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

Weird API name. It should be requiresDebugScope

@gottesmm gottesmm force-pushed the sil-debug-info-more-verification branch from 7d60941 to 38e6c6f Compare May 18, 2021 03:45
@gottesmm
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 38e6c6fa356d186fd41dd1222ca7300a636969b5

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 38e6c6fa356d186fd41dd1222ca7300a636969b5

gottesmm added 3 commits May 19, 2021 19:07
…gument.

This function only uses the reference in a const way, so nothing changes
functionally, we can just pass it into contexts where we have a const
reference without fighting the compiler.
…on of debug info on SILInstructions into a method on SILInstruction.

The verifier just invokes this method, so we aren't losing any verification in
the SILVerifier itself.

The reason why I am extracting this information into a helper is that often
times one hits these structural assertions in the verifier making one have to
track down where in a pass the bad location was actually inserted. To make these
easier to find, I am going to change the SILBuilder to invoke these structural
comparisons so that we can catch these problems at the call site making it
easier to fix code.
…tructurally with the provided SILLocation.

These checks used to be in the SILVerifier only so one had to drop down into the
debugger to figure out where a pass actually introduced the bad location. With
this change, we abort immediately in the place in the code where the problem
happens allowing for one to quickly fix the problems.
@gottesmm gottesmm force-pushed the sil-debug-info-more-verification branch from 38e6c6f to e88134b Compare May 20, 2021 02:09
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test windows platform

@gottesmm gottesmm merged commit ae7e301 into swiftlang:main May 20, 2021
@gottesmm gottesmm deleted the sil-debug-info-more-verification branch May 20, 2021 18:04
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.

4 participants