OSDN Git Service

[GCOV] Emit the writeout function as nested loops of global data.
authorChandler Carruth <chandlerc@gmail.com>
Wed, 2 May 2018 22:24:39 +0000 (22:24 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 2 May 2018 22:24:39 +0000 (22:24 +0000)
commitdf9a986c159a13c6bdcff158829d3c4af471afb7
tree9e4572de6c4b0c74de94b34a92b9ae4919b4b775
parent8f8e40c8e2dc438cdee1338d9f48ff905cafcb3d
[GCOV] Emit the writeout function as nested loops of global data.

Summary:
Prior to this change, LLVM would in some cases emit *massive* writeout
functions with many 10s of 1000s of function calls in straight-line
code. This is a very wasteful way to represent what are fundamentally
loops and creates a number of scalability issues. Among other things,
register allocating these calls is extremely expensive. While D46127 makes this
less severe, we'll still run into scaling issues with this eventually. If not
in the compile time, just from the code size.

Now the pass builds up global data structures modeling the inputs to
these functions, and simply loops over the data structures calling the
relevant functions with those values. This ensures that the code size is
a fixed and only data size grows with larger amounts of coverage data.

A trivial change to IRBuilder is included to make it easier to build
the constants that make up the global data.

Reviewers: wmi, echristo

Subscribers: sanjoy, mcrosier, llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D46357

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331407 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/IRBuilder.h
lib/Transforms/Instrumentation/GCOVProfiling.cpp
test/Transforms/GCOVProfiling/function-numbering.ll