Skip to content
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

Remove unnecessary LLVMRustPersonalityFn binding #39319

Merged
merged 1 commit into from Feb 3, 2017

Conversation

nagisa
Copy link
Member

@nagisa nagisa commented Jan 26, 2017

LLVM Core C bindings provide this function for all the versions back to what we support (3.7), and
helps to avoid this unnecessary builder->function transition every time. Also a negative diff.

Fixes #38462 (although it was pretty much fixed already)

@nagisa
Copy link
Member Author

nagisa commented Jan 26, 2017

Since I’m on battery currently, didn’t build to check if it works yet.

@rust-highfive
Copy link
Collaborator

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@nagisa nagisa force-pushed the remove-rustsetpersonalityfn branch from 19a2ab3 to 20738b6 Compare January 26, 2017 18:53
@@ -1105,12 +1105,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}

pub fn set_personality_fn(&self, personality: ValueRef) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we keep this but change it to call llvm::LLVMSetPersonalityFn(self.llfn(), llpersonality); instead of inlining it? That would keep the unsafe more local to builder.rs which is a win, I believe.

Granted this does save us one builder to function transition, but I don't think (hope) that's an expensive operation.

LLVM Core C bindings provide this function for all the versions back to what we support (3.7), and
helps to avoid this unnecessary builder->function transition every time. Also a negative diff.
@nagisa nagisa force-pushed the remove-rustsetpersonalityfn branch from 20738b6 to 1363cda Compare January 27, 2017 12:42
bcx.set_personality_fn(mircx.ccx.eh_personality());
unsafe {
llvm::LLVMSetPersonalityFn(mircx.llfn, mircx.ccx.eh_personality());
}
Copy link
Member

Choose a reason for hiding this comment

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

... am I right in inferring from this change that bcx.llfn() is not the same as mircx.llfn? It seems surprising.

And If that is actually true... it probably could use a comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is the same. It just avoids going through LLVM to get the information that’s already available here.

Copy link
Member

Choose a reason for hiding this comment

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

Okay. I would personally have left it alone, but I don't care enough to block this PR.

@pnkfelix
Copy link
Member

pnkfelix commented Feb 1, 2017

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 1, 2017

📌 Commit 1363cda has been approved by pnkfelix

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 2, 2017
… r=pnkfelix

Remove unnecessary LLVMRustPersonalityFn binding

LLVM Core C bindings provide this function for all the versions back to what we support (3.7), and
helps to avoid this unnecessary builder->function transition every time. Also a negative diff.

Fixes rust-lang#38462 (although it was pretty much fixed already)
bors added a commit that referenced this pull request Feb 2, 2017
Rollup of 9 pull requests

- Successful merges: #38823, #39196, #39299, #39319, #39373, #39383, #39416, #39420, #39427
- Failed merges:
@bors bors merged commit 1363cda into rust-lang:master Feb 3, 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.

Properly fix the personality_fn setting in MIR trans
5 participants