This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/70041] gcc -O2 generate different assembly code
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 02 Mar 2016 12:39:06 +0000
- Subject: [Bug c/70041] gcc -O2 generate different assembly code
- Auto-submitted: auto-generated
- References: <bug-70041-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70041
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-03-02
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
You could say that, yes. The first case gets disambiguated into two nested
loops where we remove the inner "empty" one. The second variant says as a
single loop (it happens to have only a single latch at the beginning).
Good initial CFG:
main (int argc, char * * argv)
{
long unsigned int i;
int D.2253;
<bb 2>:
i = 0;
<bb 3>:
i = i + 1;
if (i > 536870911)
goto <bb 4>;
else
goto <bb 3>;
<bb 4>:
__builtin_puts (&"hello"[0]);
i = 0;
goto <bb 3>;
"bad" initial CFG:
main (int argc, char * * argv)
{
long unsigned int i;
int D.2253;
<bb 2>:
i = 0;
<bb 3>:
if (i > 536870911)
goto <bb 4>;
else
goto <bb 5>;
<bb 4>:
__builtin_puts (&"hello"[0]);
i = 0;
<bb 5>:
i = i + 1;
goto <bb 3>;