-O4 a.k.a. link-time optimization

  • I'm exploring ways to make my app Instaviz run faster. In Xcode 4.0.2
    there's the option to use the clang 2.0 compiler which appears much
    more stable and performant than Xcode 3.2.x's clang 1.5/1.6. There's
    also the option to turn on link-time optimization with -O4, and my
    initial tests with x64 code seem good.

    I'd like any tips/experience/caveats with using link-time optimization.

    1.    Does it actually work on armv6/armv7/iOS builds as of Xcode
    4.0.2?
    2.    Since -O4 apparently produces LLVM object files, can I freely
    link both LLVM and native object files to produce a native app? i.e.
    do -O4 on some compiles and leave it out on other compiles?
    3.    On command-line builds do I have to pass anything special to
    the ld linker? Or does it automatically do LTO when it sees LLVM
    object files?
    4.    Is it still incompatible with debug symbols? What is the end-
    user result of shipping an app with LTO -- will the crash reports I
    get back from users be unsymbolicatable??

    Cheers,
    Glen Low
    Pixelglow Software
    http://instaviz.com
  • On Sat, 4 Jun 2011 19:43:34 +0800, Glen Low said:

    > I'd like any tips/experience/caveats with using link-time optimization.

    I've tried building several of the 3rd party open source projects I use
    with -O4, and all of them fail.  They do build at -00 and -O3 however.
    My impression is that -O4 is not fully baked.  It's been a few months
    since I've tried however, maybe things are better now.

    --
    ____________________________________________________________
    Sean McBride, B. Eng                <sean...>
    Rogue Research                        www.rogue-research.com
    Mac Software Developer              Montréal, Québec, Canada
  • Sean

    On 07/06/2011, at 12:49 AM, Sean McBride wrote:

    > On Sat, 4 Jun 2011 19:43:34 +0800, Glen Low said:
    >
    >> I'd like any tips/experience/caveats with using link-time
    >> optimization.
    >
    > I've tried building several of the 3rd party open source projects I
    > use
    > with -O4, and all of them fail.  They do build at -00 and -O3 however.
    > My impression is that -O4 is not fully baked.  It's been a few months
    > since I've tried however, maybe things are better now.

    I had a similar experience with open-source Graphviz, pre-4.0. The
    current Xcode seems to build it cleanly though -- the resulting object
    files at -O4 appear to be LLVM bytecode and not native code, and the
    linker seems to handle everything nicely. I ended up with around a 4%
    speed up on x64 code, the small delta probably more a testament to the
    efficiency of Graphviz code rather than the inefficiency of LTO. Just
    want to be sure whether I should flip the switch on my iOS/armv7 code
    or not.

    Cheers, Glen Low

    ---
    pixelglow software | simply brilliant stuff
    www.pixelglow.com
    aim: pixglen
    twitter: pixelglow
  • On Tue, 7 Jun 2011 12:24:21 +0800, Glen Low said:

    >>> I'd like any tips/experience/caveats with using link-time
    >>> optimization.
    >>
    >> I've tried building several of the 3rd party open source projects I
    >> use
    >> with -O4, and all of them fail.  They do build at -00 and -O3 however.
    >> My impression is that -O4 is not fully baked.  It's been a few months
    >> since I've tried however, maybe things are better now.
    >
    > I had a similar experience with open-source Graphviz, pre-4.0. The
    > current Xcode seems to build it cleanly though -- the resulting object
    > files at -O4 appear to be LLVM bytecode and not native code, and the
    > linker seems to handle everything nicely. I ended up with around a 4%
    > speed up on x64 code, the small delta probably more a testament to the
    > efficiency of Graphviz code rather than the inefficiency of LTO. Just
    > want to be sure whether I should flip the switch on my iOS/armv7 code
    > or not.

    I don't touch Xcode 4 with a 10 foot pole, but I have been using a build
    of clang from svn from a few days ago.  I just tried again with a couple
    of open source projects.  With one, I get crazy link errors at -O4, with
    the other it now links, where it did not months ago.

    So it seems it has progressed, but is not quite fully baked yet.
    Looking forward to it though!

    Cheers,

    --
    ____________________________________________________________
    Sean McBride, B. Eng                <sean...>
    Rogue Research                        www.rogue-research.com
    Mac Software Developer              Montréal, Québec, Canada
previous month june 2011 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
Go to today