Fix some errors introduced by rL370563 which were not exposed on my local machine.

1. zlib::compress accept &size_t but the param is an uint64_t.
2. Some systems don't have zlib installed. Don't use compression by default.

llvm-svn: 370564
This commit is contained in:
Wei Mi 2019-08-31 03:17:49 +00:00
parent 798e59b81f
commit 198009ae8d
3 changed files with 4 additions and 3 deletions

View File

@ -637,7 +637,7 @@ private:
// Determine whether or not to compress the symbol list when
// writing it into profile. The variable is unused when the symbol
// list is read from an existing profile.
bool ToCompress = true;
bool ToCompress = false;
DenseSet<StringRef> Syms;
BumpPtrAllocator Allocator;
};

View File

@ -211,7 +211,8 @@ std::error_code ProfileSymbolList::read(uint64_t CompressSize,
StringRef CompressedStrings(reinterpret_cast<const char *>(Data),
CompressSize);
char *Buffer = Allocator.Allocate<char>(UncompressSize);
llvm::Error E = zlib::uncompress(CompressedStrings, Buffer, UncompressSize);
size_t UCSize = UncompressSize;
llvm::Error E = zlib::uncompress(CompressedStrings, Buffer, UCSize);
if (E)
return sampleprof_error::uncompress_failed;
ListStart = Buffer;

View File

@ -637,7 +637,7 @@ static int merge_main(int argc, const char *argv[]) {
cl::desc("Path to file containing the list of function symbols "
"used to populate profile symbol list"));
cl::opt<bool> CompressProfSymList(
"compress-prof-sym-list", cl::init(true), cl::Hidden,
"compress-prof-sym-list", cl::init(false), cl::Hidden,
cl::desc("Compress profile symbol list before write it into profile. "));
cl::ParseCommandLineOptions(argc, argv, "LLVM profile data merger\n");