PRE in GCC-3.3.3

James E Wilson wilson@specifixinc.com
Wed Mar 16 00:14:00 GMT 2005


Rajesh Babu wrote:
>     I found that PRE is not done in gcc-3.3.3, though the code for doing 
> PRE exists in source code.

gcc-3.3 is not interesting for work like this.  The PRE support in 
gcc-3.3 has already been effectively obsoleted by other work in current 
gcc sources, though it is still there.

You failed to specify the target.  The target often makes a big 
difference on whether optimizations are performed.  I am assuming the 
target is ia64-linux.

Your testcase incidentally is serious flawed.  The varible c is both 
used while uninitialized, and set using an unitialized value.  It 
doesn't make much sense to talk about compiler optimizations when you 
have a testcase that invokes undefined behaviour.

The testcase is also flawed in that it takes the address of both a and 
b, forcing them into memory, and thus making optimization of them 
difficult, particularly in pre-gcc-4 sources.

I seem to get the same behaviour from both gcc-3.3 and gcc-3.4.  In 
neither case is the partially redundant expression eliminated.

gcc-4 does perform the optimization.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list