Implemented suggestion by dblakie in review for r250704.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250723
91177308-0d34-0410-b5e6-
96231b3b80d8
/// Write the specified function summary index to the given raw output stream,
/// where it will be written in a new bitcode block. This is used when
/// writing the combined index file for ThinLTO.
/// Write the specified function summary index to the given raw output stream,
/// where it will be written in a new bitcode block. This is used when
/// writing the combined index file for ThinLTO.
- void WriteFunctionSummaryToFile(const FunctionInfoIndex *Index,
+ void WriteFunctionSummaryToFile(const FunctionInfoIndex &Index,
raw_ostream &Out);
/// isBitcodeWrapper - Return true if the given bytes are the magic bytes
raw_ostream &Out);
/// isBitcodeWrapper - Return true if the given bytes are the magic bytes
/// Emit function names and summary offsets for the combined index
/// used by ThinLTO.
/// Emit function names and summary offsets for the combined index
/// used by ThinLTO.
-static void WriteCombinedValueSymbolTable(const FunctionInfoIndex *Index,
+static void WriteCombinedValueSymbolTable(const FunctionInfoIndex &Index,
BitstreamWriter &Stream) {
Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);
BitstreamWriter &Stream) {
Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);
// FIXME: We know if the type names can use 7-bit ascii.
SmallVector<unsigned, 64> NameVals;
// FIXME: We know if the type names can use 7-bit ascii.
SmallVector<unsigned, 64> NameVals;
- for (const auto &FII : *Index) {
+ for (const auto &FII : Index) {
for (const auto &FI : FII.getValue()) {
NameVals.push_back(FI->bitcodeIndex());
for (const auto &FI : FII.getValue()) {
NameVals.push_back(FI->bitcodeIndex());
/// Write the module path strings, currently only used when generating
/// a combined index file.
/// Write the module path strings, currently only used when generating
/// a combined index file.
-static void WriteModStrings(const FunctionInfoIndex *I,
+static void WriteModStrings(const FunctionInfoIndex &I,
BitstreamWriter &Stream) {
Stream.EnterSubblock(bitc::MODULE_STRTAB_BLOCK_ID, 3);
BitstreamWriter &Stream) {
Stream.EnterSubblock(bitc::MODULE_STRTAB_BLOCK_ID, 3);
unsigned Abbrev6Bit = Stream.EmitAbbrev(Abbv);
SmallVector<unsigned, 64> NameVals;
unsigned Abbrev6Bit = Stream.EmitAbbrev(Abbv);
SmallVector<unsigned, 64> NameVals;
- for (const StringMapEntry<uint64_t> &MPSE : I->modPathStringEntries()) {
+ for (const StringMapEntry<uint64_t> &MPSE : I.modPathStringEntries()) {
StringEncoding Bits =
getStringEncoding(MPSE.getKey().data(), MPSE.getKey().size());
unsigned AbbrevToUse = Abbrev8Bit;
StringEncoding Bits =
getStringEncoding(MPSE.getKey().data(), MPSE.getKey().size());
unsigned AbbrevToUse = Abbrev8Bit;
/// Emit the combined function summary section into the combined index
/// file.
/// Emit the combined function summary section into the combined index
/// file.
-static void WriteCombinedFunctionSummary(const FunctionInfoIndex *I,
+static void WriteCombinedFunctionSummary(const FunctionInfoIndex &I,
BitstreamWriter &Stream) {
Stream.EnterSubblock(bitc::FUNCTION_SUMMARY_BLOCK_ID, 3);
BitstreamWriter &Stream) {
Stream.EnterSubblock(bitc::FUNCTION_SUMMARY_BLOCK_ID, 3);
unsigned FSAbbrev = Stream.EmitAbbrev(Abbv);
SmallVector<unsigned, 64> NameVals;
unsigned FSAbbrev = Stream.EmitAbbrev(Abbv);
SmallVector<unsigned, 64> NameVals;
- for (const auto &FII : *I) {
+ for (const auto &FII : I) {
for (auto &FI : FII.getValue()) {
FunctionSummary *FS = FI->functionSummary();
assert(FS);
for (auto &FI : FII.getValue()) {
FunctionSummary *FS = FI->functionSummary();
assert(FS);
- NameVals.push_back(I->getModuleId(FS->modulePath()));
+ NameVals.push_back(I.getModuleId(FS->modulePath()));
NameVals.push_back(FS->instCount());
// Record the starting offset of this summary entry for use
NameVals.push_back(FS->instCount());
// Record the starting offset of this summary entry for use
// Write the specified function summary index to the given raw output stream,
// where it will be written in a new bitcode block. This is used when
// writing the combined index file for ThinLTO.
// Write the specified function summary index to the given raw output stream,
// where it will be written in a new bitcode block. This is used when
// writing the combined index file for ThinLTO.
-void llvm::WriteFunctionSummaryToFile(const FunctionInfoIndex *Index,
+void llvm::WriteFunctionSummaryToFile(const FunctionInfoIndex &Index,
raw_ostream &Out) {
SmallVector<char, 0> Buffer;
Buffer.reserve(256 * 1024);
raw_ostream &Out) {
SmallVector<char, 0> Buffer;
Buffer.reserve(256 * 1024);
if (EC)
message(LDPL_FATAL, "Unable to open %s.thinlto.bc for writing: %s",
output_name.data(), EC.message().c_str());
if (EC)
message(LDPL_FATAL, "Unable to open %s.thinlto.bc for writing: %s",
output_name.data(), EC.message().c_str());
- WriteFunctionSummaryToFile(&CombinedIndex, OS);
+ WriteFunctionSummaryToFile(CombinedIndex, OS);
OS.close();
cleanup_hook();
OS.close();
cleanup_hook();
<< ".thinlto.bc': " << EC.message() << "\n";
return 1;
}
<< ".thinlto.bc': " << EC.message() << "\n";
return 1;
}
- WriteFunctionSummaryToFile(&CombinedIndex, OS);
+ WriteFunctionSummaryToFile(CombinedIndex, OS);