Commit Graph

2 Commits

Author SHA1 Message Date
Hamish Knight
350e28b4b7 [Profiler] Rework profiling of top-level code
Instead of creating and destroying a SILProfiler
per TopLevelCodeDecl, setup a single profiler
for the top-level entry point function, and visit
all the TopLevelCodeDecls when mapping regions.
2022-10-14 17:45:14 +01:00
Hamish Knight
cc465937a2 [IRGen] Emit name data for unused coverage counters
Previously, if all the coverage counters for a
given SIL function were optimized out, we would
have dropped the coverage map on the floor,
leading to inaccurate coverage reports in `-O`.
However LLVM allows us to emit the name data for
the coverage maps separately by defining an
`__llvm_coverage_names` global with the name data,
which is picked up by its instrumentation lowering
pass. Use this to continue to emit coverage maps
for functions that do not get emitted.

rdar://99813754
2022-09-16 15:47:16 +01:00