about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize/src/partitioning
AgeCommit message (Collapse)AuthorLines
2025-08-14Complete functionality and general cleanupMarcelo Domínguez-143/+0
2025-04-16working dupv and dupvonly for fwd modeManuel Drehwald-2/+30
2025-03-11Remove some dead codeOli Scherer-5/+0
2025-03-11Explain the actual reason why stripping binders is fineOli Scherer-6/+5
2025-02-21clean up autodiff code/commentsManuel Drehwald-1/+1
2025-01-29upstream rustc_codegen_ssa/rustc_middle changes for enzyme/autodiffManuel Drehwald-0/+121
2023-05-30Rename `partitioning/mod.rs` as `partitioning.rs`.Nicholas Nethercote-1182/+0
Because it's now the only file within `compiler/rustc_monomorphize/src/partitioning/`.
2023-05-30Merge `default.rs` into `mod.rs`.Nicholas Nethercote-649/+632
Within `compiler/rustc_monomorphize/src/partitioning/`, because the previous commit removed the need for `default.rs` to be a separate file.
2023-05-30Remove `-Zcgu-partitioning-strategy`.Nicholas Nethercote-394/+276
This option was introduced three years ago, but it's never been meaningfully used, and `default` is the only acceptable value. Also, I think the `Partition` trait presents an interface that is too closely tied to the existing strategy and would probably be wrong for other strategies. (My rule of thumb is to not make something generic until there are at least two instances of it, to avoid this kind of problem.) Also, I don't think providing multiple partitioning strategies to the user is a good idea, because the compiler already has enough obscure knobs. This commit removes the option, along with the `Partition` trait, and the `Partitioner` and `DefaultPartitioning` types. I left the existing code in `compiler/rustc_monomorphize/src/partitioning/default.rs`, though I could be persuaded that moving it into `compiler/rustc_monomorphize/src/partitioning/mod.rs` is better.
2023-05-26Add struct for the return type of `place_root_mono_items`.Nicholas Nethercote-6/+13
As per review request.
2023-05-25Remove some unnecessary `pub` markers.Nicholas Nethercote-2/+2
2023-05-24Add a clarifying comment.Nicholas Nethercote-0/+2
This is something that took me some time to figure out.
2023-05-24Remove `{Pre,Post}InliningPartitioning`.Nicholas Nethercote-87/+64
I find that these structs obfuscate the code. Removing them and just passing the individual fields around makes the `Partition` method signatures a little longer, but makes the data flow much clearer. E.g. - `codegen_units` is mutable all the way through. - `codegen_units`'s length is changed by `merge_codegen_units`, but only the individual elements are changed by `place_inlined_mono_items` and `internalize_symbols`. - `roots`, `internalization_candidates`, and `mono_item_placements` are all immutable after creation, and all used by just one of the four methods.
2023-05-24Remove the `merging` module.Nicholas Nethercote-109/+94
Three of the four methods in `DefaultPartitioning` are defined in `default.rs`. But `merge_codegen_units` is defined in a separate module, `merging`, even though it's less than 100 lines of code and roughly the same size as the other three methods. (Also, the `merging` module currently sits alongside `default`, when it should be a submodule of `default`, adding to the confusion.) In #74275 this explanation was given: > I pulled this out into a separate module since it seemed like we might > want a few different merge algorithms to choose from. But in the three years since there have been no additional merging algorithms, and there is no mechanism for choosing between different merging algorithms. (There is a mechanism, `-Zcgu-partitioning-strategy`, for choosing between different partitioning strategies, but the merging algorithm is just one piece of a partitioning strategy.) This commit merges `merging` into `default`, making the code easier to navigate and read.
2023-05-24Inline and remove `numbered_codegen_unit_name`.Nicholas Nethercote-8/+3
It is small and has a single call site, and this change will facilitate the next commit.
2023-05-19Improve CGU partitioning debug output.Nicholas Nethercote-10/+16
- Pass a slice instead of an iterator to `debug_dump`. - For each CGU set, print: the number of CGUs, the max and min size, and the ratio of the max and min size (which indicates how evenly sized they are). - Print a `FINAL` entry, showing the absolute final results.
2023-05-19Fix an ICE in CGU dumping code.Nicholas Nethercote-2/+2
2023-05-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-1/+1
2023-05-06make (try_)subst_and_normalize_erasing_regions take EarlyBinderKyle Matsuda-1/+1
2023-04-27rename `needs_subst` to `has_param`Boxy-1/+1
2023-04-22Auto merge of #110567 - JohnBobbo96:monomorphize-dyn-dispatch, r=b-naberbors-20/+91
Remove some uses of dynamic dispatch during monomorphization/partitioning. This removes a few uses of dynamic dispatch and instead uses generics, as well as an enum to allow for other partitioning methods to be added later.
2023-04-20Remove WithOptconstParam.Camille GILLOT-3/+2
2023-04-19Remove a few uses of dynamic dispatch duringJohn Bobbo-20/+91
monomorphization/partitioning with the use of an enum.
2023-04-17Spelling - compilerJosh Soref-1/+1
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-15fix clippy::{filter_map_identiy, map_identity, manual_flatten}Matthias Krüger-1/+1
2023-04-10Fix typos in compilerDaniPopes-1/+1
2023-04-01fix clippy::iter_kv_mapMatthias Krüger-4/+1
2023-03-29Support TLS access into dylibs on WindowsJohn Kåre Alsaker-14/+21
2023-03-27Add a builtin `FnPtr` traitlcnr-2/+4
2023-03-07Simplify `sort_by` callsMaybe Waffle-2/+2
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+1
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-02-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-1/+1
2023-01-31Auto merge of #100754 - davidtwco:translation-incremental, r=compiler-errorsbors-10/+8
incremental: migrate diagnostics - Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`. - Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`. - Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs. r? `@compiler-errors` cc #100717
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-10/+8
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30use a more descriptive nameTshepang Mbambo-2/+2
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-6/+5
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2023-01-02Fix `unknown_crate` when `--crate-name` isn't passed on the CLIJoshua Nelson-4/+4
2023-01-02Add json output to `-Zdump-mono-stats`Joshua Nelson-16/+32
This allows analyzing the output programatically; for example, finding the item with the highest `total_estimate`. I also took the liberty of adding `untracked` tests to `rustc_session` and documentation to the unstable book for `dump-mono-items`.
2022-12-25fix more clippy::style findingsMatthias Krüger-1/+1
match_result_ok obfuscated_if_else single_char_add writeln_empty_string collapsible_match iter_cloned_collect unnecessary_mut_passed
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-5/+2
2022-12-14wrap output in BufWriterRémy Rakic-2/+3
2022-12-14add `-Z dump-mono-stats`Rémy Rakic-1/+76
This option will output some stats from the monomorphization collection pass to a file, to show estimated sizes from each instantiation.
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-3/+3
spastorino noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.
2022-08-31Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwcoRalf Jung-8/+5
Migrate rustc_monomorphize to use SessionDiagnostic ### Description - Migrates diagnostics in `rustc_monomorphize` to use `SessionDiagnostic` - Adds an `impl IntoDiagnosticArg for PathBuf` ### TODO / Help! - [x] I'm having trouble figuring out how to apply an optional note. 😕 Help!? - Resolved. It was bad docs. Fixed in https://github.com/rust-lang/rustc-dev-guide/pull/1437/files - [x] `errors:RecursionLimit` should be `#[fatal ...]`, but that doesn't exist so it's `#[error ...]` at the moment. - Maybe I can switch after this is merged in? --> https://github.com/rust-lang/rust/pull/100694 - Or maybe I need to manually implement `SessionDiagnostic` instead of deriving it? - [x] How does one go about converting an error inside of [a call to struct_span_lint_hir](https://github.com/rust-lang/rust/blob/8064a495086c2e63c0ef77e8e82fe3b9b5dc535f/compiler/rustc_monomorphize/src/collector.rs#L917-L927)? - [x] ~What placeholder do you use in the fluent template to refer to the value in a vector? It seems like [this code](https://github.com/rust-lang/rust/blob/0b79f758c9aa6646606662a6d623a0752286cd17/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs#L83-L114) ought to have the answer (or something near it)...but I can't figure it out.~ You can't. Punted.
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-1/+1
2022-08-25replace some usages of [Span]FatalError with error-specific typesNathan Stocks-10/+3
2022-08-25rebased: convert rustc_monomorphize errors to SessionDiagnosticNathan Stocks-3/+7
2022-07-22Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiserDylan DPC-3/+9
Fix unreachable coverage generation for inlined functions To generate a function coverage we need at least one coverage counter, so a coverage from unreachable blocks is retained only when some live counters remain. The previous implementation incorrectly retained unreachable coverage, because it didn't account for the fact that those live counters can belong to another function due to inlining. Fixes #98833.