When using debug info for profile correlation, avoid adding duplicate
functions in the synthetic Data section.
Before this patch, n duplicate function entries in the Data section would
cause counter values to be a factor of n larger. I built instrumented
clang with and without debug info correlation and got these summaries.
# With Debug Info Correlate $ llvm-profdata show default.profdata Instrumentation level: IR entry_first = 0 Total functions: 182530 Maximum function count: 52034 Maximum internal block count: 5763 # Without $ llvm-profdata show default.profdata Instrumentation level: IR entry_first = 0 Total functions: 183212 Maximum function count: 52034 Maximum internal block count: 5766
The slight difference in counts seem to be mostly from FileSystem and
Map functions and the difference in the number of instrumented functions
seems to come from missing debug info like destructors without source.