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
diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp
index 36c39c1..e94848d 100644
--- a/llvm/lib/ProfileData/SampleProf.cpp
+++ b/llvm/lib/ProfileData/SampleProf.cpp
@@ -211,7 +211,8 @@
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;