diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-10-01 03:33:52 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-10-01 03:33:52 +0000 |
commit | f5d5d35e7e7744aa4dde1ed9180a3212fd9eb7f7 (patch) | |
tree | 79d9a58967b21d8bed5ef1e8c96e375f360d25d4 /test/CoverageMapping/includehell.cpp | |
parent | e740642d93d0a40767f89fa73927f35c636b425a (diff) |
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
Diffstat (limited to 'test/CoverageMapping/includehell.cpp')
-rw-r--r-- | test/CoverageMapping/includehell.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/CoverageMapping/includehell.cpp b/test/CoverageMapping/includehell.cpp index 4f4028d454..653f41464d 100644 --- a/test/CoverageMapping/includehell.cpp +++ b/test/CoverageMapping/includehell.cpp @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name includehell.cpp %s | FileCheck %s -// CHECK: File 0, 1:1 -> 9:7 = #0 (HasCodeBefore = 0) -// CHECK-NEXT: File 0, 2:13 -> 4:2 = #1 (HasCodeBefore = 0) -// CHECK-NEXT: File 0, 4:8 -> 6:2 = (#0 - #1) (HasCodeBefore = 0) -// CHECK-NEXT: File 0, 7:11 -> 9:2 = #2 (HasCodeBefore = 0) -// CHECK-NEXT: File 0, 9:8 -> 11:2 = (#0 - #2) (HasCodeBefore = 0) -int main() { // CHECK-NEXT: File 1, [[@LINE]]:12 -> [[@LINE+4]]:2 = #0 (HasCodeBefore = 0) +int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+4]]:2 = #0 (HasCodeBefore = 0) int x = 0; - #include "Inputs/code.h" // CHECK-NEXT: Expansion,File 1, [[@LINE]]:12 -> [[@LINE]]:27 = #0 (HasCodeBefore = 0, Expanded file = 0) + #include "Inputs/code.h" // CHECK-NEXT: Expansion,File 0, [[@LINE]]:12 -> [[@LINE]]:27 = #0 (HasCodeBefore = 0, Expanded file = 1) return 0; } +// CHECK-NEXT: File 1, 1:1 -> 9:7 = #0 (HasCodeBefore = 0) +// CHECK-NEXT: File 1, 2:13 -> 4:2 = #1 (HasCodeBefore = 0) +// CHECK-NEXT: File 1, 4:8 -> 6:2 = (#0 - #1) (HasCodeBefore = 0) +// CHECK-NEXT: File 1, 7:11 -> 9:2 = #2 (HasCodeBefore = 0) +// CHECK-NEXT: File 1, 9:8 -> 11:2 = (#0 - #2) (HasCodeBefore = 0) |