-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[MIR] MSVC SEH unwind handling #31600
Conversation
The pass removes the unwind branch of each terminator, thus moving the responsibility of handling the -Z no-landing-pads flag to a small self-contained pass… instead of polluting the translator.
fn make_landing_pad(&mut self, | ||
cleanup: BlockAndBuilder<'bcx, 'tcx>) | ||
-> BlockAndBuilder<'bcx, 'tcx> | ||
{ | ||
if base::wants_msvc_seh(cleanup.sess()) { | ||
return cleanup; | ||
} | ||
// FIXME(#30941) this doesn't handle msvc-style exceptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment can be removed now?
The SEH translation feels a little ad-hoc here with some sprinklings here and there, but otherwise doesn't seem obviously wrong to met at least! LLVM's verifier pass is pretty strict with the cleanuppad/cleanupret instructions now so if this passes there then it's likely correct |
73e972f
to
c7d6f58
Compare
@@ -148,6 +148,10 @@ impl<'a, 'm, 'tcx> Visitor<'tcx> for InnerDump<'a,'m,'tcx> { | |||
|
|||
match build_mir(Cx::new(&infcx), implicit_arg_tys, id, span, decl, body) { | |||
Ok(mut mir) => { | |||
// FIXME: This should run later rather than earlier (since this is supposed to be a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like a FIXME necessarily. Once we are done with type-checking and other things, the MIR is basically ripe for optimization in any order, and taking into account codegen options seems legit.
nits addressed. |
c7d6f58
to
1752615
Compare
// except according to those terms. | ||
|
||
//! This pass removes the unwind branch of all the terminators when the no-landing-pads option is | ||
//! specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fairly nifty btw. =)
@bors r+ |
📌 Commit 1752615 has been approved by |
r? @alexcrichton for the translator changes and @nikomatsakis for the no-landing-pads pass.
r? @alexcrichton for the translator changes and @nikomatsakis for the no-landing-pads pass.