Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 62a7968

Browse files
committedJan 24, 2025
Auto merge of rust-lang#135986 - matthiaskrgr:rollup-eszobzi, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#135295 (Check empty SIMD vector in inline asm) - rust-lang#135873 (coverage: Prepare for upcoming changes to counter creation) - rust-lang#135926 (Implement `needs-subprocess` directive, and cleanup a bunch of tests to use `needs-{subprocess,threads}`) - rust-lang#135950 (Tidy Python improvements) - rust-lang#135956 (Make `Vec::pop_if` a bit more presentable) - rust-lang#135966 ([AIX] Allow different sized load and store in `tests/assembly/powerpc64-struct-abi.rs`) - rust-lang#135983 (Doc difference between extend and extend_from_slice) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8231e85 + b511c13 commit 62a7968

File tree

237 files changed

+632
-617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+632
-617
lines changed
 

‎compiler/rustc_middle/src/query/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,9 @@ rustc_queries! {
618618
/// Summarizes coverage IDs inserted by the `InstrumentCoverage` MIR pass
619619
/// (for compiler option `-Cinstrument-coverage`), after MIR optimizations
620620
/// have had a chance to potentially remove some of them.
621-
query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> &'tcx mir::coverage::CoverageIdsInfo {
621+
///
622+
/// Returns `None` for functions that were not instrumented.
623+
query coverage_ids_info(key: ty::InstanceKind<'tcx>) -> Option<&'tcx mir::coverage::CoverageIdsInfo> {
622624
desc { |tcx| "retrieving coverage IDs info from MIR for `{}`", tcx.def_path_str(key.def_id()) }
623625
arena_cache
624626
}

‎compiler/rustc_mir_transform/src/coverage/counters.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ use rustc_middle::mir::coverage::{CounterId, CovTerm, Expression, ExpressionId,
1111

1212
use crate::coverage::counters::balanced_flow::BalancedFlowGraph;
1313
use crate::coverage::counters::iter_nodes::IterNodes;
14-
use crate::coverage::counters::node_flow::{CounterTerm, MergedNodeFlowGraph, NodeCounters};
14+
use crate::coverage::counters::node_flow::{
15+
CounterTerm, NodeCounters, make_node_counters, node_flow_data_for_balanced_graph,
16+
};
1517
use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph};
1618

1719
mod balanced_flow;
@@ -27,20 +29,20 @@ pub(super) fn make_bcb_counters(
2729
) -> CoverageCounters {
2830
// Create the derived graphs that are necessary for subsequent steps.
2931
let balanced_graph = BalancedFlowGraph::for_graph(graph, |n| !graph[n].is_out_summable);
30-
let merged_graph = MergedNodeFlowGraph::for_balanced_graph(&balanced_graph);
32+
let node_flow_data = node_flow_data_for_balanced_graph(&balanced_graph);
3133

3234
// Use those graphs to determine which nodes get physical counters, and how
3335
// to compute the execution counts of other nodes from those counters.
34-
let nodes = make_node_counter_priority_list(graph, balanced_graph);
35-
let node_counters = merged_graph.make_node_counters(&nodes);
36+
let priority_list = make_node_flow_priority_list(graph, balanced_graph);
37+
let node_counters = make_node_counters(&node_flow_data, &priority_list);
3638

3739
// Convert the counters into a form suitable for embedding into MIR.
3840
transcribe_counters(&node_counters, bcb_needs_counter)
3941
}
4042

4143
/// Arranges the nodes in `balanced_graph` into a list, such that earlier nodes
4244
/// take priority in being given a counter expression instead of a physical counter.
43-
fn make_node_counter_priority_list(
45+
fn make_node_flow_priority_list(
4446
graph: &CoverageGraph,
4547
balanced_graph: BalancedFlowGraph<&CoverageGraph>,
4648
) -> Vec<BasicCoverageBlock> {
@@ -81,11 +83,11 @@ fn transcribe_counters(
8183
let mut new = CoverageCounters::with_num_bcbs(bcb_needs_counter.domain_size());
8284

8385
for bcb in bcb_needs_counter.iter() {
84-
// Our counter-creation algorithm doesn't guarantee that a counter
85-
// expression starts or ends with a positive term, so partition the
86+
// Our counter-creation algorithm doesn't guarantee that a node's list
87+
// of terms starts or ends with a positive term, so partition the
8688
// counters into "positive" and "negative" lists for easier handling.
8789
let (mut pos, mut neg): (Vec<_>, Vec<_>) =
88-
old.counter_expr(bcb).iter().partition_map(|&CounterTerm { node, op }| match op {
90+
old.counter_terms[bcb].iter().partition_map(|&CounterTerm { node, op }| match op {
8991
Op::Add => Either::Left(node),
9092
Op::Subtract => Either::Right(node),
9193
});
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.