Compressing with llvm-ar

Hello,

The documentation for llvm-ar says that option ‘z’ is used to compressed a file before archiving it. I did some tests with different input files (text and LLVM bitcode) and found the archive to be about the same size as the input. When debugging I found that the compressed flag gets passed to several calls and eventually makes it to Archive::writeMember() but this function doesn’t do anything with it.

Is compression working with llvm-ar? Can someone provide an example of how to use it? My command line looks something like llvm-ar rcz [archive_name] [input_file]

Thanks,

Javier

Hi,

I haven’t seen any reply to this. Can someone please point me to the persons maintaining llvm-ar? I can direct my questions to them.

Thanks,

Javier

llvm-ar cannot do compression.

- Michael Spencer

llvm-ar cannot do compression.

I think this is a leftover from the days we used to have a *byte*code
and use bzip2 on it :slight_smile:

I will try to clean it up.

- Michael Spencer

Cheers,
Rafael

I think this is a leftover from the days we used to have a *byte*code
and use bzip2 on it :slight_smile:

I will try to clean it up.

The attached patch removes all references to compression from llvm-ar,
llvm-ranlib and related libraries.

Is it OK?

Cheers,
Rafael

t.patch (9.92 KB)

LGTM.

And I had forgotten that llvm-ar still uses exceptions...

- Michael Spencer

Oops, forgot. This patch needs to also update the documentation.

- Michael Spencer

It's too bad that the compression feature was dropped. Can you share why?

I was interested in using llvm-ar to compress LLVM outputs. My experiments show that BC and PCH files are highly compressible (~35% of original size). I can see many situations that would benefit from a reduced storage size. I have tried other methods for reducing the file size such as tweaking with opt options (see attached thread) but didn't get much space savings. I really liked the idea of an LLVM tool to do the compression but I guess I'll have to look elsewhere.

Thanks,
Javier

Re LLVMdev Which is more compact.bc or .ll.gz And what might be even more compact.msg (38 KB)

It's too bad that the compression feature was dropped. Can you share why?

To get rid of libbzip2 dependency iirc