Need some clarification about optimization flags, what "exactly" does -O1 do?

Andrew Haley aph@redhat.com
Sat Nov 29 11:50:00 GMT 2008


Andrzej Giniewicz wrote:

>> That's interesting.  tree-dce is Dead Code Elimination on trees, where
>> gcc removes code that can't possibly be reached.  It's possible that
>> there's a bug in DCE, but I bet it's something like the enum bug above.
>> If you're interested in finding the real bug I can tell you how to read
>> the compiler dumps.
> 
> that would be sweet, finding real bugs is always better than workaround :)

Compile with -fdump-tree-all.  You'll see dozens of dump files like

hello.c.037t.addressables2
hello.c.036t.dce1
hello.c.035t.mergephi1
hello.c.034t.copyprop1
hello.c.033t.esra
hello.c.032t.sdse1
hello.c.031t.addressables1
hello.c.030t.forwprop1

Diff the pass before dce and the post-dce dump and you'll see what dce did.
There are several dce passes.

Also, you can diff the final optimized code with and without dce.

Andrew.



More information about the Gcc-help mailing list