[PATCH] D35586: [ProfData] Detect if zlib is available
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 15:17:29 PDT 2017
On Wed, Jul 19, 2017 at 2:35 PM Wei-Ren Chen via Phabricator <
reviews at reviews.llvm.org> wrote:
> chenwj updated this revision to Diff 107382.
> chenwj added a comment.
>
> @dblaikie I upload the profile data and test case. However, the error
> message I check including the full path of the profile data. Any idea on
> how can I improve this?
>
>
> https://reviews.llvm.org/D35586
>
> Files:
> include/llvm/ProfileData/InstrProf.h
> lib/ProfileData/InstrProf.cpp
> test/tools/llvm-profdata/Inputs/compressed.profraw
> test/tools/llvm-profdata/nocompress.test
>
>
> Index: test/tools/llvm-profdata/nocompress.test
> ===================================================================
> --- /dev/null
> +++ test/tools/llvm-profdata/nocompress.test
> @@ -0,0 +1,5 @@
> +RUN: not llvm-profdata show %p/Inputs/compressed.profraw -o %t 2>&1 |
> FileCheck %s
> +
> +REQUIRES: nozlib
> +
> +CHECK: error:
> /Users/chenwj/Projects/llvm/test/tools/llvm-profdata/Inputs/compressed.profraw:
> Profile uses zlib compression but the profile reader was built without zlib
> support
>
FileCheck supports regex:
CHECK: error: {{.*}}compressed.profraw: Profile uses ...
> Index: lib/ProfileData/InstrProf.cpp
> ===================================================================
> --- lib/ProfileData/InstrProf.cpp
> +++ lib/ProfileData/InstrProf.cpp
> @@ -111,6 +111,8 @@
> return "Failed to uncompress data (zlib)";
> case instrprof_error::empty_raw_profile:
> return "Empty raw profile file";
> + case instrprof_error::zlib_unavailable:
> + return "Profile uses zlib compression but the profile reader was
> built without zlib support";
> }
> llvm_unreachable("A value of instrprof_error has no message.");
> }
> @@ -430,6 +432,9 @@
> SmallString<128> UncompressedNameStrings;
> StringRef NameStrings;
> if (isCompressed) {
> + if (!llvm::zlib::isAvailable())
> + return
> make_error<InstrProfError>(instrprof_error::zlib_unavailable);
> +
> StringRef CompressedNameStrings(reinterpret_cast<const char *>(P),
> CompressedSize);
> if (Error E =
> Index: include/llvm/ProfileData/InstrProf.h
> ===================================================================
> --- include/llvm/ProfileData/InstrProf.h
> +++ include/llvm/ProfileData/InstrProf.h
> @@ -295,7 +295,8 @@
> value_site_count_mismatch,
> compress_failed,
> uncompress_failed,
> - empty_raw_profile
> + empty_raw_profile,
> + zlib_unavailable
> };
>
> inline std::error_code make_error_code(instrprof_error E) {
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170719/12f9d507/attachment.html>
More information about the llvm-commits
mailing list