[llvm] [LLVM] Add zstd and zlib compressed frame magic to LLVM magic (PR #222773)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 09:05:00 PDT 2026
jhuber6 wrote:
> I think you've misunderstood my suggestion. If you take a look at the [clang AST reader](https://github.com/llvm/llvm-project/blob/36763294ef639d8a6a4379d81da653dda1c20686/clang/lib/Serialization/ASTReader.cpp#L1932), it knows that data is compressed, but determines the compression type using the magic bytes. It doesn't use `identify_magic` however. My recommendation would be to extract the magic detection and subsequent decompression used there into a new method within the `llvm::compression` namespace. This would avoid duplicating the logic there, without having to add zstd/zlib detection to the more generic `identify_magic` without a more general need for it.
So you want something like `llvm::compression::getType(ArrayRef<>)`? To me, I don't see what's special about `llvm::identify_magic` that prevents us from identifying magic in this way. If we're going that direction, I'd instead argume that the decompression routine just do it implicitly and we skip this whole step.
https://github.com/llvm/llvm-project/pull/222773
More information about the llvm-commits
mailing list