about summary refs log tree commit diff
path: root/src/test/codegen-units
AgeCommit message (Collapse)AuthorLines
2021-03-09Deprecate items that accidentally weren't deprecatedbstrie-39/+39
Fixes #82080
2020-10-26simplify-locals: Remove unused assignments regardless of rvalue kindTomasz Miąsko-2/+1
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-23/+23
2020-08-30ty: remove obsolete printerDavid Wood-360/+358
This commit removes the obsolete printer and replaces all uses of it with `FmtPrinter`. Of the replaced uses, all but one use was in `debug!` logging, two cases were notable: - `MonoItem::to_string` is used in `-Z print-mono-items` and therefore affects the output of all codegen-units tests. - `DefPathBasedNames` was used in `librustc_codegen_llvm/type_of.rs` with `LLVMStructCreateNamed` and that'll now get different values, but this should result in no functional change. Signed-off-by: David Wood <david@davidtw.co>
2020-08-09instance: only polymorphize upvar substsDavid Wood-52/+0
This commit restricts the substitution polymorphization added in #75255 to only apply to the tupled upvar substitution, rather than all substitutions, fixing a bunch of regressions when polymorphization is enabled. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: polymorphize `FnDef` substsDavid Wood-4/+19
This commit extends previous polymorphization of substs to polymorphize `FnDef`. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: always polymorphize substsDavid Wood-0/+37
By always polymorphizing substitutions, functions which take closures as arguments (e.g. `impl Fn()`) can have fewer mono items when some of the argument closures can be polymorphized. Signed-off-by: David Wood <david@davidtw.co>
2020-07-22sess: disable polymorphisationDavid Wood-3/+3
This commit disables polymorphisation to resolve regressions related to closures which inherit unused generic parameters and are then used in casts or reflection. Signed-off-by: David Wood <david@davidtw.co>
2020-07-20mir: `unused_generic_params` queryDavid Wood-2/+325
This commit implements the `unused_generic_params` query, an initial version of polymorphization which detects when an item does not use generic parameters and is being needlessly monomorphized as a result. Signed-off-by: David Wood <david@davidtw.co>
2020-06-15Change how compiler-builtins gets many CGUsAlex Crichton-40/+0
This commit intends to fix an accidental regression from #70846. The goal of #70846 was to build compiler-builtins with a maximal number of CGUs to ensure that each module in the source corresponds to an object file. This high degree of control for compiler-builtins is desirable to ensure that there's at most one exported symbol per CGU, ideally enabling compiler-builtins to not conflict with the system libgcc as often. In #70846, however, only part of the compiler understands that compiler-builtins is built with many CGUs. The rest of the compiler thinks it's building with `sess.codegen_units()`. Notably the calculation of `sess.lto()` consults `sess.codegen_units()`, which when there's only one CGU it disables ThinLTO. This means that compiler-builtins is built without ThinLTO, which is quite harmful to performance! This is the root of the cause from #73135 where intrinsics were found to not be inlining trivial functions. The fix applied in this commit is to remove the special-casing of compiler-builtins in the compiler. Instead the build system is now responsible for special-casing compiler-builtins. It doesn't know exactly how many CGUs will be needed but it passes a large number that is assumed to be much greater than the number of source-level modules needed. After reading the various locations in the compiler source, this seemed like the best solution rather than adding more and more special casing in the compiler for compiler-builtins. Closes #73135
2020-04-06Keep codegen units unmerged when building compiler builtinsTomasz Miąsko-0/+40
2020-03-31Add a test case for incremental + codegen-units interaction.Michael Woerister-0/+42
2020-03-24Remove `-Z incremental`.Nicholas Nethercote-25/+25
`-C incremental` was introduced over two years ago. `-Z incremental` was kept for transitioning, but it's been long enough now that it should be ok to remove it.
2020-02-26Update codegen-units testsMatthew Jasper-33/+23
2020-01-23Make drop-glue take advantage of -Zshare-generics.Michael Woerister-4/+24
2020-01-19adjust codegen-units testsRalf Jung-38/+37
2019-10-25Update test output.Felix S. Klock II-2/+2
(My inference is that the number changed from 4 to 5 because `derive(PartialEq)` now injects an extra trait impl before.)
2019-09-23rustc: Fix mixing crates with different `share_generics`Alex Crichton-0/+2
This commit addresses #64319 by removing the `dylib` crate type from the list of crate type that exports generic symbols. The bug in #64319 arises because a `dylib` crate type was trying to export a symbol in an uptream crate but it miscalculated the symbol name of the uptream symbol. This isn't really necessary, though, since `dylib` crates aren't that heavily used, so we can just conservatively say that the `dylib` crate type never exports generic symbols, forcibly removing them from the exported symbol lists if were to otherwise find them. The fix here happens in two places: * First is in the `local_crate_exports_generics` method, indicating that it's now `false` for the `Dylib` crate type. Only rlibs actually export generics at this point. * Next is when we load exported symbols from upstream crate. If, for our compilation session, the crate may be included from a dynamic library, then its generic symbols are removed. When the crate was linked into a dynamic library its symbols weren't exported, so we can't consider them a candidate to link against. Overally this should avoid situations where we incorrectly calculate the upstream symbol names in the face of differnet `share_generics` options, ultimately... Closes #64319
2019-04-23Remove unnecessary ignore-tidy-linelengthvarkor-20/+0
2019-04-22Remove double trailing newlinesvarkor-2/+0
2018-12-25Remove licensesMark Rousskov-460/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-12-01Auto merge of #56165 - RalfJung:drop-glue-type, r=eddyb,nikomatsakisbors-37/+38
drop glue takes in mutable references, it should reflect that in its type When drop glue begins, it should retag, like all functions taking references do. But to do that, it needs to take the reference at a proper type: `&mut T`, not `*mut T`. Failing to retag can mean that the memory the reference points to remains frozen, and `EscapeToRaw` on a frozen location is a NOP, meaning later mutations cause a Stacked Borrows violation. Cc @nikomatsakis @Gankro because Stacked Borrows Cc @eddyb for the changes to miri argument passing (the intention is to allow passing `*mut [u8]` when `&mut [u8]` is expected and vice versa)
2018-11-22fix codegen-units testsRalf Jung-37/+38
2018-11-17Don't auto-inline `const fn`Oliver Scherer-2/+1
2018-10-25More mono items are generated nowOliver Schneider-0/+5
2018-10-05Stabilize `min_const_fn`Oliver Schneider-1/+0
2018-09-12Really make CGU names unique across crates.Michael Woerister-3/+3
2018-08-31Restrict most uses of `const_fn` to `min_const_fn`Oliver Schneider-1/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-1/+1
2018-08-15Adapt codegen-unit tests to new CGU naming scheme.Michael Woerister-30/+30
2018-07-16Revert "Adapt codegen-unit tests to new CGU naming scheme."Michael Woerister-30/+30
This reverts commit 94b32adb71a75a3f5b53a39c52c62c2ce1a7cc56.
2018-07-12Adapt codegen-unit tests to new CGU naming scheme.Michael Woerister-30/+30
2018-05-17Rename trans to codegen everywhere.Irina Popa-351/+349
2018-04-06Add codegen-units test for shared-generics.Michael Woerister-0/+51
2018-04-06Adapt codegen-unit test to shared-generics.Michael Woerister-2/+2
2017-12-26Convert codegen-unit tests to use `start` instead of `main`Bastian Köcher-454/+148
The new Termination traits brings in the unwinding machinery and that blows up the required `TRANS_ITEM`s.
2017-12-26Fixes codegen-units testsBastian Köcher-1/+400
2017-11-07Add regression tests for non-instantiation of inline and const fns.Michael Woerister-0/+45
2017-11-07Update codegen-unit tests.Michael Woerister-47/+47
2017-10-11rustc: Handle #[inline(always)] at -O0Alex Crichton-1/+1
This commit updates the handling of `#[inline(always)]` functions at -O0 to ensure that it's always inlined regardless of the number of codegen units used. Closes #45201
2017-10-07rustc: Don't inline in CGUs at -O0Alex Crichton-0/+67
This commit tweaks the behavior of inlining functions into multiple codegen units when rustc is compiling in debug mode. Today rustc will unconditionally treat `#[inline]` functions by translating them into all codegen units that they're needed within, marking the linkage as `internal`. This commit changes the behavior so that in debug mode (compiling at `-O0`) rustc will instead only translate `#[inline]` functions into *one* codegen unit, forcing all other codegen units to reference this one copy. The goal here is to improve debug compile times by reducing the amount of translation that happens on behalf of multiple codegen units. It was discovered in #44941 that increasing the number of codegen units had the adverse side effect of increasing the overal work done by the compiler, and the suspicion here was that the compiler was inlining, translating, and codegen'ing more functions with more codegen units (for example `String` would be basically inlined into all codegen units if used). The strategy in this commit should reduce the cost of `#[inline]` functions to being equivalent to one codegen unit, which is only translating and codegen'ing inline functions once. Collected [data] shows that this does indeed improve the situation from [before] as the overall cpu-clock time increases at a much slower rate and when pinned to one core rustc does not consume significantly more wall clock time than with one codegen unit. One caveat of this commit is that the symbol names for inlined functions that are only translated once needed some slight tweaking. These inline functions could be translated into multiple crates and we need to make sure the symbols don't collideA so the crate name/disambiguator is mixed in to the symbol name hash in these situations. [data]: https://github.com/rust-lang/rust/issues/44941#issuecomment-334880911 [before]: https://github.com/rust-lang/rust/issues/44941#issuecomment-334583384
2017-10-07rustc: Implement ThinLTOAlex Crichton-30/+30
This commit is an implementation of LLVM's ThinLTO for consumption in rustc itself. Currently today LTO works by merging all relevant LLVM modules into one and then running optimization passes. "Thin" LTO operates differently by having more sharded work and allowing parallelism opportunities between optimizing codegen units. Further down the road Thin LTO also allows *incremental* LTO which should enable even faster release builds without compromising on the performance we have today. This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then also implements two forms of ThinLTO: * In one mode we'll *only* perform ThinLTO over the codegen units produced in a single compilation. That is, we won't load upstream rlibs, but we'll instead just perform ThinLTO amongst all codegen units produced by the compiler for the local crate. This is intended to emulate a desired end point where we have codegen units turned on by default for all crates and ThinLTO allows us to do this without performance loss. * In anther mode, like full LTO today, we'll optimize all upstream dependencies in "thin" mode. Unlike today, however, this LTO step is fully parallelized so should finish much more quickly. There's a good bit of comments about what the implementation is doing and where it came from, but the tl;dr; is that currently most of the support here is copied from upstream LLVM. This code duplication is done for a number of reasons: * Controlling parallelism means we can use the existing jobserver support to avoid overloading machines. * We will likely want a slightly different form of incremental caching which integrates with our own incremental strategy, but this is yet to be determined. * This buys us some flexibility about when/where we run ThinLTO, as well as having it tailored to fit our needs for the time being. * Finally this allows us to reuse some artifacts such as our `TargetMachine` creation, where all our options we used today aren't necessarily supported by upstream LLVM yet. My hope is that we can get some experience with this copy/paste in tree and then eventually upstream some work to LLVM itself to avoid the duplication while still ensuring our needs are met. Otherwise I fear that maintaining these bindings may be quite costly over the years with LLVM updates!
2017-07-13Adapt cgu-partitioning tests to pre-trans symbol internalization.Michael Woerister-53/+53
2017-06-09Move Fn to module.Clar Charr-8/+8
2017-03-18translate drop glue using MIRAriel Ben-Yehuda-79/+40
Drop of arrays is now translated in trans::block in an ugly way that I should clean up in a later PR, and does not handle panics in the middle of an array drop, but this commit & PR are growing too big.
2017-03-18translate function shims using MIRAriel Ben-Yehuda-0/+8
2017-01-09trans: Treat generics like regular functions, not like #[inline] functions ↵Michael Woerister-12/+12
during CGU partitioning.
2016-09-27Fix fallout in tests.Jeffrey Seyfried-4/+4
2016-09-21Auto merge of #36551 - eddyb:meta-games, r=nikomatsakisbors-0/+3
Refactor away RBML from rustc_metadata. RBML and `ty{en,de}code` have had their long-overdue purge. Summary of changes: * Metadata is now a tree encoded in post-order and with relative backward references pointing to children nodes. With auto-deriving and type safety, this makes maintenance and adding new information to metadata painless and bug-free by default. It's also more compact and cache-friendly (cache misses should be proportional to the depth of the node being accessed, not the number of siblings as in EBML/RBML). * Metadata sizes have been reduced, for `libcore` it went down 16% (`8.38MB` -> `7.05MB`) and for `libstd` 14% (`3.53MB` -> `3.03MB`), while encoding more or less the same information * Specialization is used in the bundled `libserialize` (crates.io `rustc_serialize` remains unaffected) to customize the encoding (and more importantly, decoding) of various types, most notably those interned in the `TyCtxt`. Some of this abuses a soundness hole pending a fix (cc @aturon), but when that fix arrives, we'll move to macros 1.1 `#[derive]` and custom `TyCtxt`-aware serialization traits. * Enumerating children of modules from other crates is now orthogonal to describing those items via `Def` - this is a step towards bridging crate-local HIR and cross-crate metadata * `CrateNum` has been moved to `rustc` and both it and `NodeId` are now newtypes instead of `u32` aliases, for specializing their decoding. This is `[syntax-breaking]` (cc @Manishearth ). cc @rust-lang/compiler