[Bug middle-end/30521] "if (i == n) ++i;" or "i += i == n;"?
steven at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Nov 22 10:05:00 GMT 2008
------- Comment #6 from steven at gcc dot gnu dot org 2008-11-22 10:04 -------
Ah, now I see what Pinski meant at comment #2.
Before CSE, we still have the original code for f1:
unsigned int f(unsigned int i, unsigned int n)
{
i.20 = i + 1;
if (i.20 == n) i.20 = i.20 + 1;
return i.20;
}
After CSE (but before the first if-conversion pass) it's been transformed to:
unsigned int f(unsigned int i, unsigned int n)
{
i.20 = i + 1;
if (i.20 == n) i.20 = i + 2;
return i.20;
}
The form of the code before CSE is caught in noce_try_addcc. The second form
obviously not (because we don't know that the value of i.20 is "i + 1").
So this comes down to a pass ordering problem. Or, one could argue that CSE
should not perform this transformation if (say) "i.20 = i + 1" is not made dead
code by the transformation to "i.20 = i + 2".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30521
More information about the Gcc-bugs
mailing list