|
|
Subscribe / Log in / New account

LLVM 2.9 released

From:  Chris Lattner <clattner-AT-apple.com>
To:  llvm-announce-AT-cs.uiuc.edu
Subject:  LLVM 2.9 Release!
Date:  Wed, 06 Apr 2011 23:15:54 -0700
Message-ID:  <49A8A4DF-1B00-4C5F-8328-CAB31374B196@apple.com>

Hi LLVM Friends, Fans, Followers and Fanatics,

LLVM 2.9 is out, get it while it is fresh and steaming!
http://llvm.org/releases/ and read about it here:
http://llvm.org/releases/2.9/docs/ReleaseNotes.html

This release includes 6 months of development that provide major
enhancements and new features over the LLVM 2.8 release.  LLVM 2.9
includes much better optimization and code generation than LLVM 2.8
(particularly for modern ARM targets), improved support for C++'0x in
Clang, and a much more mature LLDB (see http://lldb.llvm.org/).

The LLVM 2.9 release notes cover the new features in LLVM in depth.
Some of the major features include integrated assembler support for ELF
targets (allowing direct object file writing), substantial improvements
for Link Time Optimization (LTO) which make it build faster and able to
compile large apps like Firefox 4, automatic recognition of memset and
memcpy loops, debugging optimized code improvements, infrastructure for
region based optimizations, better use of condition code registers, and
progress on a major register allocator rewrite.

One particularly notable aspect of this release is that it is the last
of the 2.x series.  One planned change in 3.0 is that we plan to drop
the llvm-gcc 4.2 compiler.  The Clang project provides a better solution
for C based languages and the DragonEgg project provides a good solution
for people interested in integrating LLVM with mainline GCC.

This release would not be possible without our volunteer release team.
Thanks to our release manager Bill Wendling, as well as Duncan Sands,
Anton Korobeynikov, Dimitry Andric, and NAKAMURA Takumi for their work
to qualify and shepherd the release.  If you have questions or comments
about this release, please contact the LLVMdev mailing list!  Onward to
LLVM 3.0!

-Chris

LLVM Release Announcement Linked List:
http://lists.cs.uiuc.edu/pipermail/llvm-announce/2010-Oct...



to post comments

LLVM 2.9 released

Posted Apr 7, 2011 16:47 UTC (Thu) by Hausvib6 (guest, #70606) [Link] (15 responses)

Interesting development of alternative compiler to GCC. It would be interesting to see the performance of Firefox 4 built by LLVM compared to the one build by GCC.

LLVM 2.9 released

Posted Apr 7, 2011 16:52 UTC (Thu) by kripkenstein (guest, #43281) [Link] (13 responses)

LLVM 2.9 released

Posted Apr 7, 2011 17:14 UTC (Thu) by tao (subscriber, #17563) [Link]

Too bad it's compared against gcc-4.2 which is dead ancient. Yes, I realise it's the latest version of gcc that Apple has released for MacOS X -- but then maybe doing the comparison on another platform than MacOS X would be a better choice...

LLVM 2.9 released

Posted Apr 7, 2011 17:28 UTC (Thu) by tzafrir (subscriber, #11501) [Link] (10 responses)

Wow. comparing LLVM 2.9 ("latest build") to "the latest Apple supported version of GCC" (4.2).

Next they'll compare Safary to the "latest Apple supported version of Firefox" (http://www.apple.com/downloads/macosx/internet_utilities/... - Firefox 3.6.12 ).

Interesting numbers (Datapoint: LLVM is good for building the Godzilla). But this is not a useful comparison. Any better one?

LLVM 2.9 released

Posted Apr 7, 2011 17:47 UTC (Thu) by zeekec (subscriber, #2414) [Link] (9 responses)

LLVM 2.9 released

Posted Apr 7, 2011 18:44 UTC (Thu) by jetm (subscriber, #61129) [Link] (7 responses)

No big differences between LLVM and GCC.

And this is GOOD

Posted Apr 8, 2011 6:51 UTC (Fri) by khim (subscriber, #9252) [Link] (6 responses)

Well, few years back GCC had a very clear lead, so that's good result. Not enough to switch to LLVM, obviously, but good nonetheless.

And this is GOOD

Posted Apr 8, 2011 8:08 UTC (Fri) by renox (guest, #23785) [Link] (5 responses)

I don't know: I think that Phoronix use no optimisation switch for testing compilers which make reading their compiler comparisons a waste of time.

And this is GOOD

Posted Apr 8, 2011 16:59 UTC (Fri) by jwakely (subscriber, #60262) [Link] (4 responses)

I think they use whatever switches the benchmarked software uses in its makefile - they do point out that the Himeno benchmark uses -O0 (i.e. no optimisation)

since most people just run "make" without changing CFLAGS that's not an unreasonable approach

Well, yes and usual Phoronix should be taken with huge grain of salt...

Posted Apr 8, 2011 20:05 UTC (Fri) by khim (subscriber, #9252) [Link]

since most people just run "make" without changing CFLAGS that's not an unreasonable approach

Well, sure. But we are not talking about most people. We are talking about people interested in benchmarks. These are not "most people". These people do care about flags so Phoronix benchmarks (as usual) are mostly useless. I suspected as much, but had no time to check, thnx for confirming that.

And this is GOOD

Posted Apr 10, 2011 7:22 UTC (Sun) by salimma (subscriber, #34460) [Link]

Many distributions use a standard set of CFLAGS for each architecture, and tailor them if necessary for some packages. SHouldn't be hard for Phoronix to just copy the settings used by, say, Ubuntu and Fedora.

And this is GOOD

Posted Apr 14, 2011 10:43 UTC (Thu) by cortana (subscriber, #24596) [Link] (1 responses)

Most people probably end up using autoconf, and configure uses '-g -O2' as its default CFLAGS.

And this is GOOD

Posted Apr 14, 2011 13:12 UTC (Thu) by ldarby (guest, #41318) [Link]

It's difficult to do compiler benchmarks fairly. Most compilers have -O0, -O2 etc. switches to be compatible with gcc, but really a lot of time should be spent with different and vendor specific optimisations to get the best results out of it, for your sample code, because it's not correct to assume -O2 always makes it generate the fastest code.

If you're not going to squeeze the best performance out of it, what's the point of the benchmark? It would be like measuring how fast Olympic sprinters walk to the shops or something. Maybe that is what you want to measure, but it doesn't say who's fastest.

LLVM 2.9 released

Posted Apr 8, 2011 3:12 UTC (Fri) by Hausvib6 (guest, #70606) [Link]

DragonEgg results are interesting. So the best result is obtained by combining GCC and LLVM...

LLVM 2.9 released

Posted Apr 7, 2011 17:28 UTC (Thu) by jwakely (subscriber, #60262) [Link]

comparing llvm to a three year old gcc, as seems to be common for such benchmarks

I wonder what "things that you need to build Firefox on OS X" gcc doesn't support, as mentioned in the comments

LLVM 2.9 released

Posted Apr 8, 2011 18:43 UTC (Fri) by daglwn (guest, #65432) [Link]

It's one measurement, but the value of LLVM goes way beyond the raw performance of the code it generates. In the end, LLVM is a code generator with some transformation passes that run in front of it. The value is in its modularity. There are lots of compilerish projects using LLVM. Some (perhaps most) of those projects generate better code than you can currently get out of gcc or many other compilers out there.

LLVM is a piece of the compiler. It's not the whole thing. But it's a necessary and very valuable piece. It's hard to overestimate the impact it's had in the programming tools field.

LLVM 2.9 released

Posted Apr 7, 2011 20:45 UTC (Thu) by scotthall (guest, #73671) [Link] (29 responses)

I wonder why there is so little interest in llvm/clang from the kernel devs? Developers like Ingo Molnar, H. P. Anvin and Linus himself often write about the idiocities of gcc, especially concerning the inlining behaviour.

LLVM 2.9 released

Posted Apr 7, 2011 20:54 UTC (Thu) by nix (subscriber, #2304) [Link]

Well, among other things LLVM also inlines the hell out of small functions... because in almost all situations you *want* to do that (at least where the code is used in hot spots). In fact if you don't do that in C++ at least it kills performance. (Obviously you don't want to inline so much it causes code bloat: that *also* kills performance. But you do want to inline.)

LLVM 2.9 released

Posted Apr 7, 2011 23:08 UTC (Thu) by cesarb (subscriber, #6266) [Link] (26 responses)

Perhaps because it has not reached yet full compatibility with the levels of gcc abuse found on the Linux kernel:

http://llvm.org/bugs/showdependencytree.cgi?id=4068&h...

LLVM 2.9 released

Posted Apr 8, 2011 1:24 UTC (Fri) by coriordan (guest, #7544) [Link] (25 responses)

There's no abuse. That's the difference between a real world compiler and a test suite for a spec. The former is written to provide what developers need and want.

If any project wanted a compiler that just followed the spec, gcc has a "--pedantic" switch which disables all the extensions and deviations from the standard. I've never heard of anyone using this switch, so I guess everyone generally likes the design decisions of gcc.

LLVM 2.9 released

Posted Apr 8, 2011 2:07 UTC (Fri) by bk (guest, #25617) [Link] (21 responses)

The projects that could compile with -pedantic don't bother (their code is already correct), the ones that can't don't care.

Actually I seem to remember one or two projects that use "-pedantic -ansi" by default, I just can't think of them off the top of my head.

LLVM 2.9 released

Posted Apr 8, 2011 3:05 UTC (Fri) by Trelane (subscriber, #56877) [Link] (14 responses)

-pedantic and -Wall and -Werror should be standard by anyone who really cares about not having broken code. I also use the gnu99 standard (for C) 'cause I don't mind the extensions.

LLVM 2.9 released

Posted Apr 10, 2011 8:33 UTC (Sun) by lkundrak (subscriber, #43452) [Link] (13 responses)

-Werror with -Wall? Is that a joke? Sure, it's good tool to enforce code quality, but given how much does what compiler consider suspicious vary between different versions it's almost guaranteed to break builds with newer compilers if you leave it in your Makefile. Not to say it does not have anything to do with broken code; is declaring a variable and not using it or skipping extra parentheses in conditionals with assignement "broken?"

LLVM 2.9 released

Posted Apr 11, 2011 8:25 UTC (Mon) by mpr22 (subscriber, #60784) [Link] (11 responses)

I'm sure that's a rhetorical question, but I don't think the answer to the last sentence of your comment is quite what you think it is. My answers are "maybe" and "yes", respectively.

LLVM 2.9 released

Posted Apr 11, 2011 17:01 UTC (Mon) by wahern (subscriber, #37304) [Link] (10 responses)

`if (foo = bar) { ... }' isn't broken. In fact `if (foo = bar || 1) { ... }' isn't broken either, just very uncommon.

But I also disagree that -Werror shouldn't be used. I use it all the time. And when it breaks my code, rather than concede defeat I submit a patch. I submitted a patch to clang which added a switch to disable duplicate initializer warnings (like GCC has). It's valid and useful code and the C99 standard even specifies the behavior--the last initializer wins. I use it with compound literals and named initializers when I want an inline automatic object with default initializations:

struct options { int foo; int bar; };
#define FOO_DEFAULT 7
#define opts(...) (&(struct options){ .foo = FOO_DEFAULT, __VA_ARGS__ })

do_blah(blah, opts(.foo = 14, .bar = 12))

It took me a couple of days to learn enough about clang to be able to submit the patch, but that's what the community is all about--scratching our own itches. It's a privilege but also a responsibility.

LLVM 2.9 released

Posted Apr 11, 2011 18:03 UTC (Mon) by mpr22 (subscriber, #60784) [Link]

OK, I'll concede that it might merely be mindblowingly bad style instead of broken - but the compiler's warning profile does not have that luxury, thanks to the ease with which one can typo the equality operator as the simple-assignment operator. Anyone who knowingly uses "if (foo = bar) { ... }" shouldn't; to me, it smacks of "job security".

LLVM 2.9 released

Posted Apr 12, 2011 8:04 UTC (Tue) by jezuch (subscriber, #52988) [Link] (8 responses)

> `if (foo = bar) { ... }' isn't broken. In fact `if (foo = bar || 1) { ... }' isn't broken either, just very uncommon.

The point of most of the warnings like that is that it *might* be a mistake, and the practice shows that it very often is. A variable that is assigned but not read might seem harmless, but it might mean that you intended to use it but made a typo and used something else instead. I tend to turn as many warnings like this as possible, not only for this reason, but also because I love removing unused code ;)

In the particular case quoted above it is of course a valid usage, but you should make it explicit, like this:

if ((foo = bar) == true) { ... }

No warning, no confusion. And BTW, an idiom like this is much more common in loops.

LLVM 2.9 released

Posted Apr 12, 2011 9:05 UTC (Tue) by dark (guest, #8483) [Link] (2 responses)

I think that depends on your idiom :) It's commonly used like this:
if (result = check_something()) {
    do_something_with(result);
}
It's particularly handy if "check_something" is a regexp match. As a matter of style, it's a good way of emphasizing the if-then logic of the check more than the role of 'result'.

LLVM 2.9 released

Posted Apr 12, 2011 10:14 UTC (Tue) by mpr22 (subscriber, #60784) [Link]

I'm not a huge fan of that construct either. (What we really need is an alternative form for the simple assignment operator so that we don't need syntactic salt or "yes I meant to do that" comment annotations.)

LLVM 2.9 released

Posted Apr 12, 2011 12:10 UTC (Tue) by foom (subscriber, #14868) [Link]

I recently discovered that:
<pre>
if (char *str = get_str()) {
do_something_with(str);
}
</pre>
is valid C++. Pretty handy. :)

LLVM 2.9 released

Posted Apr 12, 2011 10:47 UTC (Tue) by cesarb (subscriber, #6266) [Link] (2 responses)

> if ((foo = bar) == true) { ... }

What is wrong with

foo = bar;
if (foo) { ... }

I believe most cases of assignment within an if can be moved to just before the if.

This discussion makes more sense with a while, or perhaps with a more complex if condition. Even then, in a lot of cases I believe you could either move the assignment outside or use a for loop, without making the code more complex or writing the same assignment in two places.

LLVM 2.9 released

Posted Apr 12, 2011 22:17 UTC (Tue) by daglwn (guest, #65432) [Link] (1 responses)

> What is wrong with

> foo = bar;
> if (foo) { ... }

At least in C++, there's a scoping difference.

LLVM 2.9 released

Posted Apr 13, 2011 10:26 UTC (Wed) by mpr22 (subscriber, #60784) [Link]

The C++ (think it works in C99 too, but not sure) construct that gives you the scoping restriction also gives the compiler (and any human observer reviewing the code) enough information to be absolutely sure you meant "assign" instead of "compare". (It's still fugly, but that's life. :-)

LLVM 2.9 released

Posted Apr 13, 2011 20:12 UTC (Wed) by vonbrand (subscriber, #4458) [Link] (1 responses)

Just that it means something else entirely... if bar's value isn't the same as true, your version of the condition fails, while the original only fails if bar == 0.

LLVM 2.9 released

Posted Apr 15, 2011 7:48 UTC (Fri) by jezuch (subscriber, #52988) [Link]

>Just that it means something else entirely... if bar's value isn't the same as true, your version of the condition fails, while the original only fails if bar == 0.

Doesn't matter; it's just an example. And since I come from a Java background, where this is a problem only in boolean context, I reflexively chose true :)

LLVM 2.9 released

Posted Apr 12, 2011 17:33 UTC (Tue) by hamjudo (guest, #363) [Link]

I worked on a proprietary software package with 15 to 25 full time programmers. We used -Werror and -Wall on the nightly build for years, and they were still using it when I left. You can disable individual warnings, if desired. When we first turned on -Werror and -Wall, we had to disable many warnings. We were down to only about 4 when I left.

It is easy to write a script in Perl, Python, or the scripting language of your choice to rewrite individual lines of code so they no longer trigger a warning. I'd re-enable one warning at a time. If it only showed up in a few places, I would rewrite them by hand. If there were hundreds or thousands of errors, then I would code a script. Keep in mind that gcc politely gives the line numbers and filenames for each warning. So the script didn't have to hunt down the noncompliant code, it just had to fix the lines known to trigger the warnings.

Being lazy, I coded the scripts to look for the most common safe ways that our programmers had annoyed gcc. When the script couldn't find a matching pattern, it would flag it for me to investigate. At least half of the time, the ones which didn't match my list of safe patterns were true bugs.

Likewise, in new code, the warnings were truly bad code at least half of the time.

Hmm?

Posted Apr 8, 2011 7:01 UTC (Fri) by khim (subscriber, #9252) [Link] (5 responses)

How can you prove that you code is correct WRT to pedantic if you don't use the flag? The project which care do use it: take a look here for example.

The fact that most people out there don't care about quality can not change the fact that it's bad idea to blindly compile everything without -pedantic. In the rare cases where you REALLY need a GCC extension you can always use __extension__ - this way all such places are clearly marked in the code.

Hmm?

Posted Apr 8, 2011 7:45 UTC (Fri) by mpr22 (subscriber, #60784) [Link] (1 responses)

Haven't got a current GCC handy, but there are certainly extensions which you can't make -pedantic not complain about in 4.3.2 - case ranges being the one I just checked.

Are you sure?

Posted Apr 8, 2011 20:21 UTC (Fri) by khim (subscriber, #9252) [Link]

Hmm... Perhaps it's recent change, but with GCC 4.4 everything works fine:
$ cat test.c
#include <stdio.h>

int main(int argc, char **argv) {
  __extension__ (({
    switch (argc) {
      case 0 ... 5:
        printf("0 ... 5");
        break;
      default:
        printf("default");
        break;
    }
  }));
  return 0;
}
$ gcc --version
gcc-4.4 (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -ansi -pedantic ./test.c -o test
$ ./test 1
0 ... 5
$ ./test 1 2 3 4 5 6
default

Hmm?

Posted Apr 8, 2011 11:24 UTC (Fri) by coriordan (guest, #7544) [Link] (2 responses)

Why should anyone care about being compatible with pedantic?

"pedantic" is one dialect of C, and gnu99 is another. The former implements what some spec writers think developers should need, and the latter implements what developers have found necessary/useful. And practically everyone chooses the latter. No surprise, IMO.

Actually no.

Posted Apr 8, 2011 20:33 UTC (Fri) by khim (subscriber, #9252) [Link] (1 responses)

And practically everyone chooses the latter.

"Practically everyone"? Pushlease. Most developers chooses different dialect or C (and C++). The fact that people don't like to write standard-conformant code is unfotunate, but don't fool yourself: GCC users are still a minority. "Mobile revolution" looks promising, but then it'll introduce yet-another-dialect-of-C (the one discussed here today) so I'm not sure G99 will have any hope of obtaining majority, let alone reaching status of "practically everyone".

Actually no.

Posted Apr 9, 2011 8:26 UTC (Sat) by mpr22 (subscriber, #60784) [Link]

The GNU compiler supports every platform that might conceivably be of interest to me, including the only one MSVC supports. I see no reason to go out of my way to ignore its extensions, or ram syntactic salt into my code to get their use approved. (As it happens, I largely avoid its extensions.)

Compiler abuse

Posted Apr 8, 2011 10:46 UTC (Fri) by cesarb (subscriber, #6266) [Link] (1 responses)

Even if you follow the spec, it still can be compiler (and preprocessor) abuse.

Did you ever take a look at some of those things?

RELOC_HIDE
"#define if" (CONFIG_PROFILE_ALL_BRANCHES)
BUILD_BUG_ON and variants
_THIS_IP_
asmlinkage_protect

Not to mention all the code which depends on the optimizer eliminating dead code (often one of the dead branches is a reference to a nonexistent function, to make the linker complain if the dead branches were not eliminated). Often using __builtin_constant_p and variants.

There are several more; these are just the ones I could remember off the top of my head.

Compiler abuse

Posted Apr 8, 2011 10:50 UTC (Fri) by cesarb (subscriber, #6266) [Link]

In case I did not make myself clear: most of my examples do not follow the official C specification. But AFAIK BUILD_BUG_ON and friends do, and in fact work by abusing it to break the build if the parameter value is wrong.

The ones which do not follow the official C specification still abuse the gcc extensions.

LLVM 2.9 released

Posted Apr 21, 2011 13:03 UTC (Thu) by PaXTeam (guest, #24616) [Link]

sorry to burst your bubble this late, but i can't help remembering some famous words here: http://lkml.indiana.edu/hypermail/linux/kernel/0710.3/151... and http://lkml.org/lkml/2007/10/25/186 . yeah, so much for what "everyone generally likes" ;).

LLVM 2.9 released

Posted Apr 8, 2011 6:17 UTC (Fri) by danieldk (subscriber, #27876) [Link]

Slightly related, on x86 and x86_64 FreeBSD, the kernel and userland compile under clang:

http://wiki.freebsd.org/BuildingFreeBSDWithClang

LLVM 2.9 released

Posted Apr 24, 2011 19:26 UTC (Sun) by mlopezibanez (guest, #66088) [Link]

Actually, it would be extremely interesting some information about this:

http://events.linuxfoundation.org/events/collaboration-su...

I find interesting that there was a whole session about LLVM and, even more, that Mark Mitchell was there speaking about LLVM ecosystem.


Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds