This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
What does un-cse exactly refer to?
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 24 Aug 2003 05:00:03 -0400 (EDT)
- Subject: What does un-cse exactly refer to?
Hi,
Consider the following piece of code.
unsigned long g;
void
foo (unsigned long a)
{
if (a == 0)
{
// bar ();
g = 0;
}
}
The interesting part of the rtx after cse looks like
(set (cc0)
(compare (reg:SI 17)
(const_int 0)))
(set (pc)
(if_then_else (ne (cc0)
(const_int 0))
(label_ref 19)
(pc)))
(set (mem/f:SI (symbol_ref:SI ("g")))
(reg:SI 17)) ***
(code_label 19 ...)
See the *** above. This is originally (const_int 0), but cse changes
it to (reg:SI 17), which is known to have (const_int 0). This change
is a win in this particular example, but even with bar() in the above
code uncommented, the same change happens, raising the register
pressure because a non-call-clobbering register must be used just to
hold (const_int 0) across a function call.
Is this problem what "un-cse" in http://gcc.gnu.org/projects/ would
try to solve?
Interestingly, this happens on h8300 port but not on i386. Maybe, cse
does not notice an implicit set (a == 0) on i386!? By the way, the
cost of (const_int 0) is 0 on h8300 port.
Thanks,
Kazu Hirata