void InstrProfiling::lowerCoverageData(GlobalVariable *CoverageNamesVar) { ConstantArray *Names = cast<ConstantArray>(CoverageNamesVar->getInitializer()); for (unsigned I = 0, E = Names->getNumOperands(); I < E; ++I) { Constant *NC = Names->getOperand(I); Value *V = NC->stripPointerCasts(); assert(isa<GlobalVariable>(V) && "Missing reference to function name"); GlobalVariable *Name = cast<GlobalVariable>(V); Name->setLinkage(GlobalValue::PrivateLinkage); ReferencedNames.push_back(Name); NC->dropAllReferences(); } CoverageNamesVar->eraseFromParent(); }