Skip to content

Conversation

@luqmana
Copy link
Contributor

@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
Contributor

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

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
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 20, 2025
The `has_eligible_receiver()` function had been adapted *a minima* when
the `sym::ControlFlow` diagnostic item has been added to rustc. This
refactors the function content to make its meaning clearer.

changelog: none
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