Redundant logical operations left after early splitting

hutchinsonandy@aim.com hutchinsonandy@aim.com
Tue Feb 19 14:57:00 GMT 2008


I am stumped and hope someone more skilled can give me some clues to 
solve this problem I have  4.3/4.4 gcc.

I have created RTL define/splits for AVR port logical operation 
(AND,IOR etc). These split larger mode operations in to QImode 
operations. I also created similar splitters for zero_extend and some 
combined zero_extended shift operations.

All of these create QImode moves of subregs and all split before reload 
(ie unconditional).

They all split as expected at first oppertunity and produce expected 
RTL. Whoppee!

When code involves zero constants (created by zero_extend, or shift) I 
can see propagation of constant into following logical operations. (Os 
or O3 optimizations). Such as:

Rx = 0
OR Ry,Rx

becoming

OR Ry,0

The propagation is fine, BUT the creation of OR Ry,0  is a totally 
redundant operation and  remains intact thru all further passes into 
final code - apparently not being removed by any optimisations after 
split1 pass!

I created RTL pattern to remove these (splitting  OR Rx,0 into NOP) and 
that removes them - but surely this workaround should not be needed. I 
am stumped by what could be causing the problem. Help!

There also seem to be cases where zero constants are not propagated 
into instructions. Yet testcase only involves simple operands, no loops 
or conditionals or any other side effects that might be reason to block 
this. Can anyone suggest some non-obvious reasons for this?

Andy





________________________________________________________________________
More new features than ever.  Check out the new AIM(R) Mail ! - 
http://webmail.aim.com



More information about the Gcc mailing list