[llvm] r370564 - Fix some errors introduced by rL370563 which were not exposed on my local machine.

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 20:17:49 PDT 2019


Author: wmi
Date: Fri Aug 30 20:17:49 2019
New Revision: 370564

URL: http://llvm.org/viewvc/llvm-project?rev=370564&view=rev
Log:
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.


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

Modified: llvm/trunk/include/llvm/ProfileData/SampleProf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/SampleProf.h?rev=370564&r1=370563&r2=370564&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/SampleProf.h (original)
+++ llvm/trunk/include/llvm/ProfileData/SampleProf.h Fri Aug 30 20:17:49 2019
@@ -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;
 };

Modified: llvm/trunk/lib/ProfileData/SampleProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/SampleProf.cpp?rev=370564&r1=370563&r2=370564&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/SampleProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/SampleProf.cpp Fri Aug 30 20:17:49 2019
@@ -211,7 +211,8 @@ std::error_code ProfileSymbolList::read(
     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;

Modified: llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp?rev=370564&r1=370563&r2=370564&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp (original)
+++ llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp Fri Aug 30 20:17:49 2019
@@ -637,7 +637,7 @@ static int merge_main(int argc, const ch
       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");




More information about the llvm-commits mailing list