[LLVMdev] llvm-gcc : why no optimization?

vishal kanaujia bluehive at gmail.com
Mon Sep 29 00:39:39 PDT 2008


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>


More information about the llvm-dev mailing list