From f59cc38992e19eae2254db515e3e3d85f6810261 Mon Sep 17 00:00:00 2001 From: Wei Mi Date: Sat, 31 Aug 2019 03:17:49 +0000 Subject: [PATCH] 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 --- include/llvm/ProfileData/SampleProf.h | 2 +- lib/ProfileData/SampleProf.cpp | 3 ++- tools/llvm-profdata/llvm-profdata.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/llvm/ProfileData/SampleProf.h b/include/llvm/ProfileData/SampleProf.h index e5cc494b92c..157c79f6772 100644 --- a/include/llvm/ProfileData/SampleProf.h +++ b/include/llvm/ProfileData/SampleProf.h @@ -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 Syms; BumpPtrAllocator Allocator; }; diff --git a/lib/ProfileData/SampleProf.cpp b/lib/ProfileData/SampleProf.cpp index 36c39c12432..e94848df24e 100644 --- a/lib/ProfileData/SampleProf.cpp +++ b/lib/ProfileData/SampleProf.cpp @@ -211,7 +211,8 @@ std::error_code ProfileSymbolList::read(uint64_t CompressSize, StringRef CompressedStrings(reinterpret_cast(Data), CompressSize); char *Buffer = Allocator.Allocate(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; diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp index d3b7c2b2c80..a894d10c9c7 100644 --- a/tools/llvm-profdata/llvm-profdata.cpp +++ b/tools/llvm-profdata/llvm-profdata.cpp @@ -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 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");