-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rollup of 29 pull requests #33610
Rollup of 29 pull requests #33610
Conversation
Long ago LLVM unfortunately didn't handle the 32-bit MSVC case of `frem` where it can't be lowered to `fmodf` because that symbol doesn't exist. That was since fixed in http://reviews.llvm.org/D12099 (landed as r246615) and was released in what appears to be LLVM 3.8. Now that we're using that branch of LLVM let's remove our own hacks and help LLVM optimize a little better by giving it knowledge about what we're doing.
When bootstrapping Rust using a previously built toolchain, I noticed a number of libraries were not copied in. As a result the copied in rustc fails to execute because it can't find all its dependences. Add them into the local_stage0.sh script.
- Adding name attribute to the sample code - Fix description sentences
Currently, to prepare for MIR trans, we break _all_ critical edges, although we only actually need to do this for edges originating from a call that gets translated to an invoke instruction in LLVM. This has the unfortunate effect of undoing a bunch of the things that SimplifyCfg has done. A particularly bad case arises when you have a C-like enum with N variants and a derived PartialEq implementation. In that case, the match on the (&lhs, &rhs) tuple gets translated into nested matches with N arms each and a basic block each, resulting in N² basic blocks. SimplifyCfg reduces that to roughly 2*N basic blocks, but breaking the critical edges means that we go back to N². In nickel.rs, there is such an enum with roughly N=800. So we get about 640K basic blocks or 2.5M lines of LLVM IR. LLVM takes a while to reduce that to the final "disr_a == disr_b". So before this patch, we had 2.5M lines of IR with 640K basic blocks, which took about about 3.6s in LLVM to get optimized and translated. After this patch, we get about 650K lines with about 1.6K basic blocks and spent a little less than 0.2s in LLVM. cc rust-lang#33111
Currently, all switches in MIR are exhausitive, meaning that we can have a lot of arms that all go to the same basic block, the extreme case being an if-let expression which results in just 2 possible cases, be might end up with hundreds of arms for large enums. To improve this situation and give LLVM less code to chew on, we can detect whether there's a pre-dominant target basic block in a switch and then promote this to be the default target, not translating the corresponding arms at all. In combination with rust-lang#33544 this makes unoptimized MIR trans of nickel.rs as fast as using old trans and greatly improves the times for optimized builds, which are only 30-40% slower instead of ~300%. cc rust-lang#33111
…hton Don't use env::current_exe with libbacktrace If the path we give to libbacktrace doesn't actually correspond to the current process, libbacktrace will segfault *at best*. cc rust-lang#21889 r? @alexcrichton cc @semarie
…sakis Remove unification despite ambiguity in projection Turns out that closures aren't explicitly considered in `project.rs`, so the ambiguity handling w.r.t. closures can just be removed as the change done in `select.rs` covers it. r? @nikomatsakis
Use symlink_metadata in tidy to avoid panicking on broken symlinks. r? @alexcrichton
Export OnceState from libstd This type is used in the signature of `call_once_force` but isn't exported from libstd. r? @alexcrichton
Fix typo in std::sync::Once documentation
[MIR trans] Optimize trans for biased switches Currently, all switches in MIR are exhausitive, meaning that we can have a lot of arms that all go to the same basic block, the extreme case being an if-let expression which results in just 2 possible cases, be might end up with hundreds of arms for large enums. To improve this situation and give LLVM less code to chew on, we can detect whether there's a pre-dominant target basic block in a switch and then promote this to be the default target, not translating the corresponding arms at all. In combination with rust-lang#33544 this makes unoptimized MIR trans of nickel.rs as fast as using old trans and greatly improves the times for optimized builds, which are only 30-40% slower instead of ~300%. cc rust-lang#33111
Support references to outer type params for assoc consts Fixes rust-lang#28809 r? @eddyb
Plumb inference obligations through selection, take 2 Using a `SnapshotVec` and dumping inferred obligations into `Vtable` variants. r? @nikomatsakis
Cleanup formatting and wording for `std::env::temp_dir` docs. None
update "reason" for fnbox feature gate It isn't "newly introduced" anymore.
Improve derived implementations for enums with lots of fieldless variants A number of trait methods like PartialEq::eq or Hash::hash don't actually need a distinct arm for each variant, because the code within the arm only depends on the number and types of the fields in the variants. We can easily exploit this fact to create less and better code for enums with multiple variants that have no fields at all, the extreme case being C-like enums. For nickel.rs and its by now infamous 800 variant enum, this reduces optimized compile times by 25% and non-optimized compile times by 40%. Also peak memory usage is down by almost 40% (310MB down to 190MB). To be fair, most other crates don't benefit nearly as much, because they don't have as huge enums. The crates in the Rust distribution that I measured saw basically no change in compile times (I only tried optimized builds) and only 1-2% reduction in peak memory usage.
…-type-path, r=eddyb re-introduce a cache for ast-ty-to-ty It turns out that `ast_ty_to_ty` is supposed to be updating the `def` after it finishes, but at some point in the past it stopped doing so. This was never noticed because of the `ast_ty_to_ty_cache`, but that cache was recently removed. This PR fixes the code to update the def properly, but apparently that is not quite enough to make the operation idempotent, so for now we reintroduce the cache too. Fixes rust-lang#33586. r? @eddyb
doc: Fix comment in std::string::String example code
…crichton rustdoc: Fix missing type parameters on impls They were broken by rust-lang#32558. Fixes: rust-lang#33592
…rister Save metadata even with -Z no-trans (e.g. for multi-crate cargo check). Removes the item symbol map in metadata, as we can now generate them in a deterministic manner. The `-Z no-trans` change lets the LLVM passes and linking run, but with just metadata and no code. It fails while trying to link a binary because there's no `main` function, which is correct but not good UX. There's also no way to easily throw away all of the artifacts to rebuild with actual code generation. We might want `cargo check` to do that using cargo-internal information and then it would just work. cc @alexcrichton @nikomatsakis @Aatch @michaelwoerister
@bors r+ p=7 |
📌 Commit 96297ea has been approved by |
⌛ Testing commit 96297ea with merge a2831f7... |
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
@bors retry force |
@nagisa nooooo this is completely broken on windows |
@bors r- |
⌛ Testing commit 96297ea with merge 244b73d... |
💔 Test failed - auto-win-msvc-64-cargotest |
☔ The latest upstream changes (presumably #33632) made this pull request unmergeable. Please resolve the merge conflicts. |
frem
#33508, Better handling of tab in error #33513, Tighten span for E0063 #33517, Copy more libraries from local Rust to stage0 #33531, Clean uphir::lowering
#33532, Add E0500 error explanation #33533, Simplify text #33534, Refactor code around LocalCrateReader. #33538, mir: don't attempt to promote Unpromotable constant temps. #33541, Only break critical edges where actually needed #33544, [MIR] Enhance the SimplifyCfg pass to merge consecutive blocks #33552, rustc: Add a new crate type, cdylib #33553, Remove unification despite ambiguity in projection #33555, Use symlink_metadata in tidy to avoid panicking on broken symlinks. #33560, Export OnceState from libstd #33563, Fix typo in std::sync::Once documentation #33565, [MIR trans] Optimize trans for biased switches #33566, Support references to outer type params for assoc consts #33572, Plumb inference obligations through selection, take 2 #33576, Cleanup formatting and wording forstd::env::temp_dir
docs. #33580, update "reason" for fnbox feature gate #33590, Improve derived implementations for enums with lots of fieldless variants #33593, re-introduce a cache for ast-ty-to-ty #33596, doc: Fix comment in std::string::String example code #33598, rustdoc: Fix missing type parameters on impls #33600