------- Additional Comments From rguenth at gcc dot gnu dot org 2005-09-02
09:54 -------
Blindly applying ifcvt to something like
int a,b;
void foo(int flag)
{
int x;
if (flag)
x=a,a=b,b=x;
}
because we're presented with
if (flag)
{
int reg_a = a;
x = reg_a;
int reg_b = b;
a = reg_b;
b = x;
}
and we get cmovs for loading a,b into pseudos instead of
loading them unconditionally. F.i.
int a,b;
void foobar(int flag)
{
if (flag)
a = b;
}
will become
foobar:
movl 4(%esp), %eax # flag, flag
testl %eax, %eax # flag
cmovne b, %edx # b,, b
movl a, %eax # a, tmp61
cmovne %edx, %eax # b,, tmp61
movl %eax, a # tmp61, a
ret
notice how we special-cased the _store_ to use a temporary. I'll
try applying the same for loads.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22568