[PGO] Cleanup: Use covmap header definition in the template file

This is one last remaining instrumentatation related structure
that needs to be migrate to use the centralized template
definition.  With this change, instrumentation code 
related to coverage module header will be kept in sync
with the coverage mapping reader. The remaining code
which makes implicit assumption about covmap control
structure layout in the the lowering pass will cleaned
up in a different patch. This patch is not intended to
have no functional change.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256715 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Xinliang David Li 2016-01-03 19:26:07 +00:00
parent 5da99c7bd4
commit adced126bd

View File

@ -238,12 +238,12 @@ void InstrProfiling::lowerCoverageData(GlobalVariable *CoverageData) {
CoverageData->setAlignment(8);
Constant *Init = CoverageData->getInitializer();
// We're expecting { i32, i32, i32, i32, [n x { i8*, i32, i32 }], [m x i8] }
// We're expecting { [4 x 32], [n x { i8*, i32, i32 }], [m x i8] }
// for some C. If not, the frontend's given us something broken.
assert(Init->getNumOperands() == 6 && "bad number of fields in coverage map");
assert(isa<ConstantArray>(Init->getAggregateElement(4)) &&
assert(Init->getNumOperands() == 3 && "bad number of fields in coverage map");
assert(isa<ConstantArray>(Init->getAggregateElement(1)) &&
"invalid function list in coverage map");
ConstantArray *Records = cast<ConstantArray>(Init->getAggregateElement(4));
ConstantArray *Records = cast<ConstantArray>(Init->getAggregateElement(1));
for (unsigned I = 0, E = Records->getNumOperands(); I < E; ++I) {
Constant *Record = Records->getOperand(I);
Value *V = const_cast<Value *>(Record->getOperand(0))->stripPointerCasts();