-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 is generating terrible code #3025
Comments
Yeah, we've seen it do this before, find me tomorrow and we'll get to the bottom of it. |
it really loves its movbs, too. seen in disassembly of libcore:
|
@bblum: do you know what function that's from? |
|
The only time I've seen this sort of thing that I can recall is when we had a very large structure being passed around/returned by value. Is that a possibility here? |
Yes, it's what's probably going on. rustc shouldn't ordinarily generate
|
I'm going to place a first bet, then, on the fact that various AST types are ginormous. For example, I just added a little profiling mode here that counts sizes, and it looks like item is 416 bytes long, expr is 184 bytes, ty is 152 bytes, etc. Perhaps I'll spend a little time rearranging these types. We treat them by value a lot more than we should. And likewise, the various sub-parts that make up each of them. |
Previously, LLVM was generating a ton of byte-by-byte copies, leading to huge numbers of vregs and bloating the code. Now, using memset, the code becomes a nice series of SSE moves instead.
This was causing a bunch of structural copies, which when inlined was leading to enormous register pressure. Often this is seen in code which makes use of result::unwrap.
I fixed a few of these. Leaving this open because I haven't investigated the parser code yet. |
We might also want to look at #4413 in parallel with this. |
Closing this because it's not very specific, and I think the issues mentioned here have been fixed. I'll report some specific issues in our IR generation instead, there are a lot of them! :) |
Add --no-deps option to avoid running on path dependencies in workspaces Since rust-lang/cargo#8758 has hit nightly, this allows us to address the second bullet point and [the concern related to `--fix`](rust-lang/cargo#8143 (comment)) in the [RUSTC_WORKSPACE_WRAPPER tracking issue](rust-lang/cargo#8143). As a reminder stabilizing that env var will solve rust-lang#4612 (Clippy not running after `cargo check` in stable) and would allow to stabilize the `--fix` option in Clippy. changelog: Add `--no-deps` option to avoid running on path dependencies in workspaces Fixes rust-lang#3025
The issue with the current code is that comments are collapsed, so comments like the one from the test end up in a string like: ``` "// this is a single line comment\n/* block = */" ``` I chose to fix it by detecting whether we're in a block comment starting from the end instead, and tested a single-line comment ended in `*/` just for sanity, ensuring line breaks are not removed in that case, which would break the formatting. The right fix eventually is probably to lex the comments properly, but this does the work for now, I guess :) Fixes rust-lang#3025
Add checked float-to-int helper function As discussed in rust-lang/miri#2989 (comment)
Bumps [ncipollo/release-action](https://github.com/ncipollo/release-action) from 1.13.0 to 1.14.0.
It probably has something to do with us not generating a memmove call instead. Here's an example from the parser.
The text was updated successfully, but these errors were encountered: