InstrProf: Avoid repeated linear searches in a hot path
When generating coverage regions, we were doing a linear search through the existing regions in order to try to merge related ones. Most of the time this would find what it was looking for in a small number of steps and it wasn't a big deal, but in cases with many regions and few mergeable ones this leads to an absurd compile time regression. This changes the coverage mapping logic to do a single sort and then merge as we go, which is a bit simpler and about 100 times faster. I've also added FIXMEs on a couple of behaviours that seem a little suspect, while keeping them behaving as they were - I'll look into these soon. The test changes here are mostly tedious reorganization, because the ordering of regions we output has become slightly (but not completely) more consistent from the almost completely arbitrary ordering we got before. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218738 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- lib/CodeGen/CoverageMappingGen.cpp 33 additions, 51 deletionslib/CodeGen/CoverageMappingGen.cpp
- test/CoverageMapping/includehell.cpp 7 additions, 7 deletionstest/CoverageMapping/includehell.cpp
- test/CoverageMapping/loopmacro.c 4 additions, 4 deletionstest/CoverageMapping/loopmacro.c
- test/CoverageMapping/macroception.c 26 additions, 23 deletionstest/CoverageMapping/macroception.c
- test/CoverageMapping/macroparams.c 6 additions, 5 deletionstest/CoverageMapping/macroparams.c
Loading
Please register or sign in to comment