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

Invoke instructions kick us off the FastISel path #3551

Closed
pcwalton opened this issue Sep 22, 2012 · 10 comments
Closed

Invoke instructions kick us off the FastISel path #3551

pcwalton opened this issue Sep 22, 2012 · 10 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-compiletime Issue: Problems and improvements with respect to compile times.

Comments

@pcwalton
Copy link
Contributor

We are never on the fast instruction selection path in LLVM because we're using Invoke instructions everywhere. Thus we pay the cost of full optimized SelectionDAG invocation at all optimization levels in rustc.

The solution is to stop using C++ exceptions for unwinding.

@brson
Copy link
Contributor

brson commented Sep 22, 2012

It is probably not very difficult to switch the landing pads to use the function return value. Initiating unwinding could be done with a tiny intrinsic.

Since we would be returning through __morestack normally the reset_stack_limit upcall would no longer be needed, reducing bloat. This will make stack management code in task_start_wrapper simpler for similar reasons.

The trickiest part may be handling an out-of-stack failure but fortunately we seem to be doing it wrong now anyway (#3555). __morestack can be changed to check the return value of upcall_new_stack for null and return early, but it will leak the arguments.

@pcwalton
Copy link
Contributor Author

We are also getting kicked off the FastISel path for two other reasons: (a) intrinsic function calls that LLVM doesn't know about; (b) invalid types (first class aggregates?) Investigating.

@pcwalton
Copy link
Contributor Author

Oh, bah. It's the memmove. FastISel wants memcpy.

@pcwalton
Copy link
Contributor Author

Slices treated as immediates ({ i8*, i64 }) cause FastISel bailouts as well. Paging @nikomatsakis because we probably need to figure out how to make these datums into non-immediates.

@nikomatsakis
Copy link
Contributor

I'm surprised that they are being treated as immediates. First place to look is type_is_immediate()---otherwise, it must be some specific code path that is causing them to get treated by value (e.g., a ++ mode argument).

@graydon
Copy link
Contributor

graydon commented Mar 25, 2013

non-critical for 0.6, de-milestoning

@pcwalton
Copy link
Contributor Author

Still true, still sad. Return-unwind fixes this.

@thestinger
Copy link
Contributor

@pcwalton: it seems like the compiler doesn't generate memmove instructions itself anymore. So at least that part is solved.

@thestinger
Copy link
Contributor

This is still a problem but the number of landing pads has been greatly reduced.

@alexcrichton
Copy link
Member

This is quite an old bug, and I believe that quite a bit of work has gone into improving this since it was opened. We still have invoke instructions, but they're necessary for the current unwinding strategy. Alterations to the unwinding strategy should now be discussed in the RFC repo rather than here, and other than that I believe this is not necessarily actionable any more, so closing.

RalfJung pushed a commit to RalfJung/rust that referenced this issue May 4, 2024
macos: use getentropy from libc

This has been added in the mean time.
RalfJung pushed a commit to RalfJung/rust that referenced this issue May 4, 2024
macos: use getentropy from libc

This has been added in the mean time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-compiletime Issue: Problems and improvements with respect to compile times.
Projects
None yet
Development

No branches or pull requests

6 participants