On Mon, 5 Sep 2016, Brandon Allbery wrote: > On Mon, Sep 5, 2016 at 8:10 PM, Fred Wright <[email protected]> wrote: > > > But when they switched to Intel, they also switched > > to -O2. This allowed them to inflate the performance benefit of the > > architecture switch. :-) > > > > ...as long as -O2 worked. Experience from FreeBSD and from early MacPorts > experiments with -O2 is that it took -O2 a long time to actually generate > correct code in a majority of cases. > That said, it might be worth looking at again --- but, -O2 reportedly still > causes occasional problems for some programs, so be ready to bail back to > -Os.
Interesting, given that the Linux kernel *requires* optimization to build correctly, due to some issue with macros vs. inline functions. Of course that's gcc, not clang, and it doesn't necessarily rule out -Os. It is unfortunate for debugging, since, gdb's claims to be able to debug optimized code notwithstanding, it's seriously deficient at it. On Mon, 5 Sep 2016, Ken Cunningham wrote: > This website reference says -Os and -O2 are identical: > > <http://stackoverflow.com/questions/15548023/clang-optimization-levels That's not necessarily true of all compilers, though, so I'd use -Os where size is important and -O2 (or greater) where speed is important. I suspect that the only reason -O2 and -Os are equivalent in clang is that they decided that nobody cares about code size any more. :-) BTW, the original poster on that page mistakenly thinks that the "s" is for speed. Fred Wright _______________________________________________ macports-dev mailing list [email protected] https://lists.macosforge.org/mailman/listinfo/macports-dev
