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

Update to LLVM head and mark various ptrs as nonnull. #14306

Merged
merged 2 commits into from
May 24, 2014

Conversation

luqmana
Copy link
Member

@luqmana luqmana commented May 20, 2014

We can now mark arguments and returns as nonnull in LLVM. It's still somewhat limited by the fact that LLVM loses this information after inlining but it might help in certain cases.

@thestinger
Copy link
Contributor

These also need to be marked in trans/callee.rs for indirect calls. It seems marking the out pointer as nocapture was forgotten in base.rs too. It would be nice to have this logic factored out... it could just generate an array based on the function type and be passed to code handling it in both cases.

@huonw
Copy link
Member

huonw commented May 20, 2014

Does this help with #11751 at all? (I'd guess not, since the pointers are all nested there.)

@thestinger
Copy link
Contributor

I think it might help if LLVM learned to leveraged the nonnull parameter guarantee in the caller in addition to the callee. Does it take advantage of that yet?

@thestinger
Copy link
Contributor

(actually it's not going to help either way)

@alexcrichton
Copy link
Member

I do think that there are many more venues of optimization possible here, but this should hopefully be a clear win in at least some situations.

For example, this doesn't look like this handles structs which contain non-null pointers. Things like trait objects, tuples, slices, etc, will all benefit from that, but just attaching to a parameter may not be sufficient.

This is merged upstream, however, and this definitely isn't detrimental, so let's push forward and see how far we can get with these optimizations!

@alexcrichton
Copy link
Member

cc #9546

ty::ty_rptr(_, mt) if mt.mutbl == ast::MutMutable => {
attrs.push((idx, lib::llvm::NoAliasAttribute as u64));
attrs.push((idx, lib::llvm::NonNullAttribute as u64));
}
Copy link
Member

Choose a reason for hiding this comment

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

This case doesn't get nocapture, but sometimes it may be able to?

@alexcrichton
Copy link
Member

Nice cleanup!

@alexcrichton
Copy link
Member

r=me with a squash of the last three commits (they all seem very closely related)

bors added a commit that referenced this pull request May 24, 2014
We can now mark arguments and returns as `nonnull` in LLVM. It's still somewhat limited by the fact that LLVM loses this information after inlining but it might help in certain cases.
@bors bors closed this May 24, 2014
@bors bors merged commit 3cae434 into rust-lang:master May 24, 2014
@luqmana luqmana deleted the up-llvm branch May 24, 2014 06:27
lnicola pushed a commit to lnicola/rust that referenced this pull request Mar 13, 2023
fix block with no termination in or patterns

fix rust-lang#14298
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.

5 participants