The names referenced by the coverage data may be associated with functions that are never emitted by Clang. That means those PGO names won't be materialized into the __llvm_prf_names section during instr-prof lowering. To make sure those names are emitted, the lowering pass will need to go through the coverage map global variable and check the referenced names.
The lowering code makes assumption about the layout of the coverage map and function record data which is error prone. Besides, in the near future, when name compression is implemented, the name references won't be available from the coverage data anymore.
In this patch, the referenced names are explicitly recorded in an internal global var and passed to the middle end. This simplifies the lowering code and also make it possible to do name compression. This is part-2 of the patch. Part-1 is http://reviews.llvm.org/D15852
Nit: Parameter names should be capitalized.