From: Xinliang David Li Date: Sun, 3 Jan 2016 19:26:07 +0000 (+0000) Subject: [PGO] Cleanup: Use covmap header definition in the template file X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=adced126bdf04a60b6857d49c04977325a3899dc;p=oota-llvm.git [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 --- diff --git a/lib/Transforms/Instrumentation/InstrProfiling.cpp b/lib/Transforms/Instrumentation/InstrProfiling.cpp index 92e41ee27c0..7a51fda38ed 100644 --- a/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -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(Init->getAggregateElement(4)) && + assert(Init->getNumOperands() == 3 && "bad number of fields in coverage map"); + assert(isa(Init->getAggregateElement(1)) && "invalid function list in coverage map"); - ConstantArray *Records = cast(Init->getAggregateElement(4)); + ConstantArray *Records = cast(Init->getAggregateElement(1)); for (unsigned I = 0, E = Records->getNumOperands(); I < E; ++I) { Constant *Record = Records->getOperand(I); Value *V = const_cast(Record->getOperand(0))->stripPointerCasts();