Hi all,
I am a newbie to LLVM and tried experimenting compile a small C program
with it.
This is what I did:
1. Wrote a simple C program with some dead code.
2. compiled it with llvm-gcc. [$ llvm-gcc -emit-llvm -S deadc.c]
3. Fetched it to assembler. [$ llvm-as deadc.s]
4. [$ opt -analyze -ade deadc.s.bc] [Ran without -analyze switch also: $opt
-o final_opt -verify-each -globaldce -f deadc.s]
Here I always get the message "Printing analysis 'Dead Global
Elimination':
Pass::print not
implemented for pass: 'Dead Global Elimination'!"
5. Now after step 4, I get a final binary and I disassemble it to see the
effect of optimization and lo ! Actually there was no sign of optimization
and each piece of code was intact?
[llvm-dis final_opt]
Am I missing something here? Please let me know.
Thanks,
Vishal
PS: Here is the version information
$ llvm-gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../llvm-gcc4.2-2.3.source/configure
--prefix=/mounts/zion/disks/0/localhome/tbrethou/2.3/test/llvm-gcc/install
--program-prefix=llvm-
--enable-llvm=/mounts/zion/disks/0/localhome/tbrethou/2.3/test/llvm-2.3/
--enable-languages=c,c++ --disable-shared --disable-bootstrap
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5555) (LLVM build 2.3)
$ /usr/local/bin/opt -version
Low Level Virtual Machine (http://llvm.org/):
llvm version 2.3
Optimized build with assertions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20080929/613579bd/attachment.html>
Hi Vishal, you might want to post the C code you were using. I suspect you wrote a function which is dead, but forgot to declare it static? If a function is not static, it is externally visible, so it's alive even when it's not referenced internally. You might want to look at the "internalize" pass as well, to make this process automatic for programs with a main function defined. Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080929/8272c983/attachment.sig>