What does un-cse exactly refer to?

Jim Wilson wilson@tuliptree.org
Mon Aug 25 22:20:00 GMT 2003


Kazu Hirata wrote:
> Is this problem what "un-cse" in http://gcc.gnu.org/projects/ would
> try to solve?

It is hard to say, since the description doesn't say much.  You could 
try going back from cvs/mail logs to figure out where this come from. 
That might give info about the original pupose.

Here is my guess.  cse only looks at one instruction at a time. 
Sometimes that isn't enough info to make the best choice.  For instance, 
suppose the cost of a constant is 2, and the cost of a register is one. 
  Then it is better to load the constant into a register if it is used 
two or more times, but it is better to use the constant directly if it 
is only used once.  But since cse only looks at one instruction at a 
time, cse can't make this distinction.  This is a common problem with 
NO_FUNCTION_CSE, for instance, which should depend on how many times a 
function address is used rather than being a yes or no answer.  This is 
not the problem you are looking at.

The problem you are looking at could perhaps be fixed with 
rematerialization in the register allocation.  When allocating pseudos 
to registers, if the register value is a constant, and that constant is 
cheaper than the register, then we put the constant back.

> Interestingly, this happens on h8300 port but not on i386.  Maybe, cse
> does not notice an implicit set (a == 0) on i386!?

Unlikely.  There is probably something more complicated going on.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list