[LLVMdev] Reproducing output of llvm-gcc using opt tool

Wojciech Matyjewicz wmatyjewicz at fastmail.fm
Fri Dec 7 01:43:16 PST 2007


Hi,

Recently, I was looking into the bug #1227. I wanted to check if
reordering optimization passes could solve it. To start with, I tried to
reproduce the output of llvm-g++ -O3 using the combination of llvm-g++
-O0 and opt with the appropriate passes. However, I was unable to. I use
SVN versions of llvm and llvm-gcc-4.2.

First, I compile example.cpp (attached; taken from the bug #1227) with:
$ llvm-g++ -c -emit-llvm -O3 -fdebug-pass-arguments example.cpp -o
example1.bc

Next, I run:
$ llvm-g++ -c -emit-llvm -O0 example.cpp -o - | opt /switches copied
from the above command debug output/ > example2.bc

The minor issue is that opt doesn't know -strip-dead-prototypes pass. Is
it possible that this pass isn't linked into the opt tool because
opt.cpp doesn't reference any symbol defined in StripDeadPrototypes.cpp.

After skipping -strip-dead-prototypes pass bitcode is produced. However,
the function assign() in example2.bc is much less optimized than in
example1.bc. Is this the expected behavior? If it is, then, what is the
correct way to reproduce llvm-gcc -O3 output with the opt tool?

-Wojtek
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: example.cpp
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071207/97f3b3c4/attachment.ksh>


More information about the llvm-dev mailing list