[llvm] fix zlib buffer truncate edge cases and fix nits in tests
authorCole Kissane <cole.kissane@gmail.com>
Wed, 13 Jul 2022 22:08:40 +0000 (15:08 -0700)
committerCole Kissane <cole.kissane@gmail.com>
Wed, 13 Jul 2022 22:08:41 +0000 (15:08 -0700)
commit6b618a620f0b964f78c176a9dc94bcc35bf0db68
tree82cae74deacc18e7d854030457958e21213c3c72
parentd843d5c8e6c9e16a8ff18cae3ff0aea3c4bace49
[llvm] fix zlib buffer truncate edge cases and fix nits in tests

- add check before truncating (un)compressed data buffer if the buffer is already a perfect length, to avoid triggering truncate assertion in edge case.
- explictly coerce LLVM_ENABLE_ZLIB to a 0 or 1 value in OFF case, to match current ON, FORCE_ON behavior.
- fix code style nits in zlib tests

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D129698
llvm/cmake/config-ix.cmake
llvm/lib/Support/Compression.cpp
llvm/unittests/Support/CompressionTest.cpp