Skip to content

Commit

Permalink
Fix some errors introduced by rL370563 which were not exposed on my l…
Browse files Browse the repository at this point in the history
…ocal 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
  • Loading branch information
wmi-11 committed Aug 31, 2019
1 parent 798e59b commit 198009a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/ProfileData/SampleProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ class ProfileSymbolList {
// 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;
};
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/ProfileData/SampleProf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-profdata/llvm-profdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 198009a

Please sign in to comment.