![]() Previously `-Zprint-mono-items` would override the mono item collection strategy. When debugging one doesn't want to change the behaviour, so this was counter productive. Additionally, the produced behaviour was artificial and might never arise without using the option in the first place (`-Zprint-mono-items=eager` without `-Clink-dead-code`). Finally, the option was incorrectly marked as `UNTRACKED`. Resolve those issues, by turning `-Zprint-mono-items` into a boolean flag that prints results of mono item collection without changing the behaviour of mono item collection. For codegen-units test incorporate `-Zprint-mono-items` flag directly into compiletest tool. Test changes are mechanical. `-Zprint-mono-items=lazy` was removed without additional changes, and `-Zprint-mono-items=eager` was turned into `-Clink-dead-code`. Linking dead code disables internalization, so tests have been updated accordingly. |
||
---|---|---|
.. | ||
auxiliary | ||
extern-drop-glue.rs | ||
extern-generic.rs | ||
incremental-merging.rs | ||
inline-always.rs | ||
inlining-from-extern-crate.rs | ||
local-drop-glue.rs | ||
local-generic.rs | ||
local-transitive-inlining.rs | ||
methods-are-with-self-type.rs | ||
README.md | ||
regular-modules.rs | ||
shared-generics.rs | ||
statics.rs | ||
vtable-through-const.rs |
codegen-units/partitioning tests
This test suite is designed to test that codegen unit partitioning works as intended. Note that it does not evaluate whether CGU partitioning is good. That is the job of the compiler benchmark suite.
All tests in this suite use the flag -Zprint-mono-items
, which makes the compiler print a machine-readable summary of all MonoItems that were collected, which CGUs they were assigned to, and the linkage in each CGU. The output looks like:
MONO_ITEM <item> @@ <cgu name>[<linkage>] <other cgu name>[<linkage in other cgu>]
The current CGU partitioning algorithm essentially groups MonoItems by which module they are defined in, then merges small CGUs. There are a lot of inline modules in this test suite because that's the only way to observe the partitioning.
Currently, the test suite is very heavily biased towards incremental builds with -Copt-level=0. This is mostly an accident of history; the entire test suite was added as part of supporting incremental compilation in #32779. But also CGU partitioning is mostly valuable because the CGU is the unit of incrementality to the codegen backend (cached queries are the unit of incrementality for the rest of the compiler).