Commit Graph

34 Commits

Author SHA1 Message Date
bjorn3 d7c0bde0c1 Remove methods from StaticCodegenMethods that are not called in cg_ssa itself 2025-05-28 20:55:00 +00:00
bjorn3 0fd257d66c Remove a couple of uses of interior mutability around statics 2025-05-28 20:55:00 +00:00
Zalathar 3f526eeec4 coverage: Revert "unused local file IDs" due to empty function names
This reverts commit 3b22c21dd8, reversing
changes made to 5f292eea6d.
2025-05-27 23:33:29 +10:00
Zalathar 078144fdfa coverage: Detect unused local file IDs to avoid an LLVM assertion
This case can't actually happen yet (other than via a testing flag), because
currently all of a function's spans must belong to the same file and expansion.
But this will be an important edge case when adding expansion region support.
2025-05-10 00:24:03 +10:00
Zalathar 8cd8b23b9e coverage: Hoist counter_for_bcb out of its loop
Having this helper function in the loop was confusing, because it doesn't rely
on anything that changes between loop iterations.
2025-05-10 00:24:03 +10:00
Zalathar 339556eb02 coverage: Enlarge empty spans during MIR instrumentation, not codegen
This allows us to assume that coverage spans will only be discarded during
codegen in very unusual situations.
2025-05-10 00:24:01 +10:00
Michael Goulet 833c212b81 Rename Instance::new to Instance::new_raw and add a note that it is raw 2025-05-05 13:17:35 +00:00
Zalathar 4322b6e97d coverage: Build the CGU's global file table as late as possible 2025-04-07 17:11:49 +10:00
Zalathar b3c40cf374 coverage: Deal with unused functions and their names in one place 2025-04-06 13:55:28 +10:00
Zalathar 75135aaf19 coverage: Extract module mapgen::unused for handling unused functions 2025-04-06 13:55:27 +10:00
Zalathar 2e36990881 coverage: Convert and check span coordinates without a local file ID
For expansion region support, we will want to be able to convert and check
spans before creating a corresponding local file ID.

If we create local file IDs eagerly, but some expansion turns out to have no
successfully-converted spans, LLVM will complain about that expansion's file ID
having no regions.
2025-03-20 13:29:32 +11:00
Zalathar d07ef5b0e1 coverage: Add LLVM plumbing for expansion regions
This is currently unused, but paves the way for future work on expansion
regions without having to worry about the FFI parts.
2025-03-20 12:40:36 +11:00
Zalathar cc8336b6c1 coverage: Don't store a body span in FunctionCoverageInfo 2025-03-18 23:18:24 +11:00
Zalathar cd2b978433 coverage: Don't refer to the body span when enlarging empty spans
Given that we now only enlarge empty spans to "{" or "}", there shouldn't be
any danger of enlarging beyond a function body.
2025-03-18 23:18:23 +11:00
Oli Scherer f16f64b15a Remove inherent function that has a trait method duplicate of a commonly imported trait 2025-02-24 15:11:29 +00:00
Zalathar bd855b6c9e coverage: Remove the old code for simplifying counters after MIR opts 2025-02-06 21:44:31 +11:00
Zalathar 20d051ec87 coverage: Defer part of counter-creation until codegen 2025-02-06 21:44:31 +11:00
Zalathar ee7dc06cf1 coverage: Store BCB node IDs in mappings, and resolve them in codegen
Even though the coverage graph itself is no longer available during codegen,
its nodes can still be used as opaque IDs.
2025-02-06 21:44:29 +11:00
Zalathar ff48331588 coverage: Make query coverage_ids_info return an Option
This reflects the fact that we can't compute meaningful info for a function
that wasn't instrumented and therefore doesn't have `function_coverage_info`.
2025-01-24 16:13:11 +11:00
Zalathar aced4dcf10 coverage: Add a synthetic test for when all spans are discarded 2024-12-19 22:03:43 +11:00
Zalathar 837a25dd41 coverage: Identify source files by ID, not by interned filename 2024-12-19 18:09:09 +11:00
Zalathar 34ed51cb83 coverage: Store coverage source regions as Span until codegen 2024-12-19 18:09:09 +11:00
Zalathar c3780e1d22 coverage: Quietly skip functions that end up having no mappings
In codegen, a used function with `FunctionCoverageInfo` but no mappings has
historically indicated a bug. However, that will no longer be the case after
moving some fallible span-processing steps into codegen.
2024-12-19 18:09:07 +11:00
Zalathar d416cead5a coverage: Rename some FFI fields from span to cov_span
This will avoid confusion with actual `Span` spans.
2024-12-19 17:26:01 +11:00
Zalathar d34c365eb0 coverage: Pull function source hash out of map_data.rs 2024-12-17 13:55:20 +11:00
Zalathar 527f8127bb coverage: Pull region conversion out of map_data.rs 2024-12-17 13:55:20 +11:00
Zalathar 252276a53d coverage: Pull expression conversion out of map_data.rs 2024-12-17 13:55:20 +11:00
Zalathar 154fae1e8d coverage: Build the global file table on the fly 2024-12-17 13:55:19 +11:00
Zalathar 5f5745beb0 coverage: Tidy up creation of covfun records 2024-12-12 22:13:07 +11:00
Zalathar 3f3a9bf7f5 coverage: Store intermediate region tables in CovfunRecord
This defers the call to `llvm_cov::write_function_mappings_to_buffer` until
just before its enclosing global variable is created.
2024-12-11 21:35:45 +11:00
Zalathar 6a8c016266 coverage: Reify CovfunRecord as an intermediate step 2024-12-11 18:25:10 +11:00
Zalathar 7c4ac71ad1 coverage: Extract function metadata handling to a covfun submodule 2024-12-11 17:49:44 +11:00
Zalathar 9461f4296f Revert "Rollup merge of #133418 - Zalathar:spans, r=jieyouxu"
This reverts commit adf9b5fcd1, reversing
changes made to af1ca153d4.

Reverting due to <https://github.com/rust-lang/rust/issues/133606>.
2024-11-29 14:57:01 +11:00
Zalathar b9fb1a69d2 coverage: Store coverage source regions as Span until codegen 2024-11-24 23:46:39 +11:00