-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[LLVM 4.0] Set EH personality when resuming stack unwinding #37862
[LLVM 4.0] Set EH personality when resuming stack unwinding #37862
Conversation
To resume stack unwinding, the LLVM `resume` instruction must be used. In order to use this instruction, the calling function must have an exception handling personality set. LLVM 4.0 adds a new IR validation check to ensure a personality is always set in these cases. This was introduced in [r277360](https://reviews.llvm.org/rL277360).
/cc @dylanmckay |
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
r? @eddy |
I feel like I've seen @alexcrichton's name on exception-handling related stuff as well. |
Seems fine to me, but I'm not too familiar with MIR trans. I'd probably imagine this'd happen somewhere where the r? @eddyb |
@bors r+ |
📌 Commit 84415ea has been approved by |
@@ -116,6 +116,9 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { | |||
if let Some(cleanup_pad) = cleanup_pad { | |||
bcx.cleanup_ret(cleanup_pad, None); | |||
} else { | |||
let llpersonality = bcx.fcx().eh_personality(); | |||
bcx.set_personality_fn(llpersonality); |
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 believe I said already in #36895, this code seems dubiously workaround-ish. Can we fix this properly, by fixing (if its not enough) up in the function near line 80.
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.
Namely, resume
should not be translated in any case where there isn’t an unwind/invoke edge. And any unwind/invoke ought to already be setting the personality_fn.
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 said already in #36895,
Apologies; I wasn't CCed on that PR, so didn't know there were already reviews :-)
… r=eddyb [LLVM 4.0] Set EH personality when resuming stack unwinding To resume stack unwinding, the LLVM `resume` instruction must be used. In order to use this instruction, the calling function must have an exception handling personality set. LLVM 4.0 adds a new IR validation check to ensure a personality is always set in these cases. This was introduced in [r277360](https://reviews.llvm.org/rL277360).
To resume stack unwinding, the LLVM
resume
instruction must be used.In order to use this instruction, the calling function must have an
exception handling personality set.
LLVM 4.0 adds a new IR validation check to ensure a personality is
always set in these cases.
This was introduced in r277360.