This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PRE in GCC-3.3.3



The target I used is i686-linux. For the same example gcc-3.4.1 eliminated the redundant expression, where as gcc-3.3.3 didn't do it. I observed it by dumping RTL with -dG switch. I didnt get abt the flaw you were talking about. The optimization is done on the pseudo registers, where is the question of forcing into memory there.


Or else can you modify the example so that pre is done on it by gcc-3.3.3.
I tried with some other examples also and found that the hash table entries of the expressions is not correct.


For this example there are 2 occurences of a+b, so in 1st pass of gcse, there will be 2 entries of a+b in hash table. For the 2nd pass these 2 are combined and made as one entry and data flows are calculated and pre is done. This procedure is followed in gcc-3.4.1, where as in gcc-3.3.3 it is not done in that fashion. Even after 2nd pass the hash table has 2 entries for a+b, so pre is not done on it.

Rajesh

On Tue, 15 Mar 2005, James E Wilson wrote:

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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]