<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - nested loops 500x slower to compile at -O2 than -Os"
   href="http://llvm.org/bugs/show_bug.cgi?id=16196">16196</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>nested loops 500x slower to compile at -O2 than -Os
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dhazeghi@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code takes much longer to compile at -O2 than at -Os, using
current clang-trunk on x86_64-linux.  This is a regression from clang 3.0.

$ clang-trunk -v
clang version 3.4 (trunk 183083)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ time clang-trunk -Os long.c 

real    0m0.047s
user    0m0.025s
sys    0m0.017s
$ time clang-3.0 -O2 long.c

real    0m0.060s
user    0m0.036s
sys    0m0.016s
$ time clang-trunk -O2 long.c 

real    0m25.436s
user    0m25.242s
sys    0m0.135s

-----------
int *a;
int b, d, e, f;
void fn1 ()
{
    int c;
    a = &c;
}

void fn2 ()
{
    for (; b; ++b)
    {
        for (d = 0; d < 9; ++d)
        {
            for (e = 0; e >= -24; --e)
            {
                for (f = 0; f <= 31; f = f + 1)
                    fn1 ();
            }
        }
    }
}

void fn3 ()
{
    fn2 ();
}

int main ()
{
    fn3 ();
    return 0;
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>