Re: Patches and some potential bugs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Patches and some potential bugs

Chris Lattner
On Sat, 29 Apr 2006, Domagoj Babic wrote:

> These should add xIDs for several passes. Please let me know if there're
> any problems with the code. I'm a very novice C++ and LLVM programmer,
> so please bear with me.

The patches look great, applied:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20060501/034450.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20060501/034451.html

Thanks!

> I ran into something suspicious:
> carrot:~/tmp> llvm-dis test5.c -o test5.ll
> llvm-dis: Invalid bytecode signature: 636E6923 (Vers=0, Pos=4)

llvm-dis does not disassemble .c files, it disassembles .bc files.
"llvm-gcc" is what turns .c files into LLVM code.

> carrot:~/tmp> which llvm-dis
> /storage/llvm/bin/llvm-dis
> carrot:~/tmp> which llvm-gcc
> /storage/llvm/bin/llvm-gcc
> carrot:~/tmp> llvm-dis --version
> Low Level Virtual Machine (llvm) 1.7 (see http://llvm.org/) DEBUG BUILD
> carrot:~/tmp> llvm-gcc --version
> llvm-gcc (GCC) 4.0.1 LLVM (Apple Computer, Inc. build 5400)
> Copyright (C) 2005 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is
> NO

> It seems that debug build of llvm-dis incorrectly complains about the
> bytecode signature (regular build disassembles it fine).

I don't think the regular build does.  Did you forget a 'b'?

> Second, -W[al],-disable-opt don't work with the new frontend for some
> reason:
>
> carrot:~/tmp/hsat> llvm-gcc -lm -Wl,-disable-opt hsat.c -o
> hsat.bc
> /usr/bin/ld: bad -rpath option
> collect2: ld returned 1 exit status
>
> carrot:~/tmp/hsat> llvm-gcc -lm -Wa,-disable-opt hsat.c -o
> hsat.bc
> as: unrecognized option `-disable-opt'

Right.  The old front-end uses a hack to run the LLVM optimizers, where it
replaces the 'as' and 'ld' tools with the LLVM "gccas" and "gccld" tools.
Because of this, there was no clean way to pass -O options down to these
tools and we end up with really horrible and ugly options like
-Wa,-disable-opt.

The new front-end is a step in a much better direction. :)   The
equivalent to:

$ llvm-gcc3 -Wa,-disable-opt hsat.c -o hsat.bc -c

is now:

$ llvm-gcc4 -O0 hsat.c -o hsat.bc -c -emit-llvm


To turn on (some) optimizations, you can pass -O[123] to llvmgcc4.
Beware that I haven't gotten around to installing the full optimization
pipeline in llvm-gcc4 though, so to get the equivalent of:

$ llvm-gcc3 hsat.c -o hsat.bc -c

I suggest using:

$ llvm-gcc4 -O3 hsat.c -o - -S -emit-llvm | gccas > hsat.bc

This will run exactly the same set of optimizations as the llvm-gcc3 does
(literally, by using the same tool :).


Note that llvmgcc4 does not currently have any wrapper to run the
link-time optimizer (gccld) yet.  As such, you'll have to run it manually
if you are interested.

At some point in the future, when I (or someone else) gets around to
plumbing up the optimization options better, it is likely that -emit-llvm
will continue to work as it does now (it outputs LLVM code at any
optimization level), but that the common way of using llvm-gcc4 in IPO
mode will be to pass -O4.  Thus, if you compile and link your program with
"llvm-gcc -O4 ..." you will get transparent IPO support.

I have many other projects to tackle, before this is a priority, but I'll
file a bugzilla bug to track this if someone is interested in helping out.

-Chris

--
http://nondot.org/sabre/
http://llvm.org/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Transparent IPO support in llvmgcc4

Chris Lattner
On Mon, 1 May 2006, Chris Lattner wrote:

> Note that llvmgcc4 does not currently have any wrapper to run the link-time
> optimizer (gccld) yet.  As such, you'll have to run it manually if you are
> interested.
>
> At some point in the future, when I (or someone else) gets around to plumbing
> up the optimization options better, it is likely that -emit-llvm will
> continue to work as it does now (it outputs LLVM code at any optimization
> level), but that the common way of using llvm-gcc4 in IPO mode will be to
> pass -O4.  Thus, if you compile and link your program with "llvm-gcc -O4 ..."
> you will get transparent IPO support.
>
> I have many other projects to tackle, before this is a priority, but I'll
> file a bugzilla bug to track this if someone is interested in helping out.

This is now PR763 for any who are interested:
http://llvm.org/PR763

-Chris

--
http://nondot.org/sabre/
http://llvm.org/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev