about summary refs log tree commit diff
path: root/src/test/codegen-units
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-2518/+0
2022-11-28Statics used in reachable function's inline asm are reachableTomasz Miąsko-0/+20
2022-09-23Bless cgu test.Camille GILLOT-3/+3
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-8/+8
2022-05-24Fix/bless tests broken by DSEJakob Degen-0/+1
2021-10-30Collect `panic/panic_bounds_check` during monomorphizationGary Guo-0/+58
2021-09-23Support incremental in compiletest for non-incremental modes.Eric Huss-27/+41
2021-04-03Remove redundant `ignore-tidy-linelength` annotationsSimon Jakobi-19/+19
This is step 2 towards fixing #77548. In the codegen and codegen-units test suites, the `//` comment markers were kept in order not to affect any source locations. This is because these tests cannot be automatically `--bless`ed.
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