Fix some errors introduced by rL370563 which were not exposed on my local machine.
authorWei Mi <wmi@google.com>
Sat, 31 Aug 2019 03:17:49 +0000 (03:17 +0000)
committerWei Mi <wmi@google.com>
Sat, 31 Aug 2019 03:17:49 +0000 (03:17 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370564 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ProfileData/SampleProf.h
lib/ProfileData/SampleProf.cpp
tools/llvm-profdata/llvm-profdata.cpp

index e5cc494b92c3283027c3dd3d7386b40d5cb5f7fb..157c79f6772fc6ecca4e5b89a94be0aa25570982 100644 (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;
 };
index 36c39c12432038ef89d48c0009130a9f3270643b..e94848df24e20fa5c7075580364c0ba7ed72b0fc 100644 (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;
index d3b7c2b2c800d0879c347bfbfa9a9f15824d1a8f..a894d10c9c7491b947183172455189cc10afc212 100644 (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");