"human readable" optimized code

Reza Roboubi reza@parvan.net
Tue Oct 14 15:31:00 GMT 2008


Diego Novillo wrote:
> On Mon, Oct 13, 2008 at 14:25, Reza Roboubi <reza@parvan.net> wrote:
> 
>> Can we get a better view of what the optimizer is doing, such as some hint
>> of which data values represent which variables inside the original C-code?
> 
> Try using -fdump-tree-all in GCC versions starting with 4.0.

Here is a simple function, calling itself in 2 places.
----------------------------------
extern int xx();
extern float yy();
extern float zz();

inline
float mm(float i, int simple)
{
     float j;
     if(simple > 99) return zz(i);
     else {
         if(i<33) j= mm(yy((int) i), xx(20));
         else j=mm(yy((int) i), xx(11));
         return j/4.7;
     }
}
-----------------------------------------------

when we do
gcc -Wall -fdump-tree-all -Os -S test.c

test.s contains a single call to mm(), instead of two distinct calls 
(correctly optimized.)

However, none of the intermediate optimization steps (such as 
test.c.t93.optimized) reflects this optimization.  Why?

Reza.



More information about the Gcc-help mailing list