This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/70041] gcc -O2 generate different assembly code


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>;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]