coverage: Eliminate more counters by giving them to unreachable nodes
When preparing a function's coverage counters and metadata during codegen, any part of the original coverage graph that was removed by MIR optimizations can be treated as having an execution count of zero. Somewhat counter-intuitively, if we give those unreachable nodes a _higher_ priority for receiving physical counters (instead of counter expressions), that ends up reducing the total number of physical counters needed. This works because if a node is unreachable, we don't actually create a physical counter for it. Instead that node gets a fixed zero counter, and any other node that would have relied on that physical counter in its counter expression can just ignore that term completely.
This commit is contained in:
parent
ef148cd7eb
commit
ab786d3b98
11 changed files with 237 additions and 229 deletions
|
@ -8,16 +8,16 @@ Number of file 0 mappings: 1
|
|||
Highest counter ID seen: c0
|
||||
|
||||
Function name: async2::async_func::{closure#0}
|
||||
Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 17, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02]
|
||||
Raw bytes (24): 0x[01, 01, 00, 04, 01, 0f, 17, 03, 09, 01, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02]
|
||||
Number of files: 1
|
||||
- file 0 => global file 1
|
||||
Number of expressions: 0
|
||||
Number of file 0 mappings: 4
|
||||
- Code(Counter(0)) at (prev + 15, 23) to (start + 3, 9)
|
||||
- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6)
|
||||
- Code(Counter(0)) at (prev + 3, 10) to (start + 2, 6)
|
||||
- Code(Zero) at (prev + 2, 5) to (start + 0, 6)
|
||||
- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2)
|
||||
Highest counter ID seen: c1
|
||||
Highest counter ID seen: c0
|
||||
|
||||
Function name: async2::async_func_just_println
|
||||
Raw bytes (9): 0x[01, 01, 00, 01, 01, 17, 01, 00, 24]
|
||||
|
@ -47,14 +47,14 @@ Number of file 0 mappings: 1
|
|||
Highest counter ID seen: c0
|
||||
|
||||
Function name: async2::non_async_func
|
||||
Raw bytes (24): 0x[01, 01, 00, 04, 01, 07, 01, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02]
|
||||
Raw bytes (24): 0x[01, 01, 00, 04, 01, 07, 01, 03, 09, 01, 03, 0a, 02, 06, 00, 02, 05, 00, 06, 01, 01, 01, 00, 02]
|
||||
Number of files: 1
|
||||
- file 0 => global file 1
|
||||
Number of expressions: 0
|
||||
Number of file 0 mappings: 4
|
||||
- Code(Counter(0)) at (prev + 7, 1) to (start + 3, 9)
|
||||
- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6)
|
||||
- Code(Counter(0)) at (prev + 3, 10) to (start + 2, 6)
|
||||
- Code(Zero) at (prev + 2, 5) to (start + 0, 6)
|
||||
- Code(Counter(0)) at (prev + 1, 1) to (start + 0, 2)
|
||||
Highest counter ID seen: c1
|
||||
Highest counter ID seen: c0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue