<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 --- - very slow compilation at -O3 on x86_64-pc-linux-gnu"
   href="http://llvm.org/bugs/show_bug.cgi?id=17461">17461</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>very slow compilation at -O3 on x86_64-pc-linux-gnu
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>su@cs.ucdavis.edu
          </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 very long time (> 200 seconds) to compile at -O3 using
the current clang-trunk and clang 3.3 on x86_64-linux. 

It appears to be a regression from clang 3.2. 


$ clang-trunk -v
clang version 3.4 (trunk 191812)
Target: x86_64-pc-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6

$ time clang-trunk -O2 reduced.c
0.44user 0.02system 0:00.79elapsed 59%CPU (0avgtext+0avgdata 58208maxresident)k
0inputs+32outputs (0major+6773minor)pagefaults 0swaps
$
$ time clang-3.2 -O3 reduced.c
0.04user 0.01system 0:00.16elapsed 33%CPU (0avgtext+0avgdata 49008maxresident)k
0inputs+32outputs (0major+5596minor)pagefaults 0swaps
$
$ time clang-trunk -O3 reduced.c
213.58user 0.15system 5:30.50elapsed 64%CPU (0avgtext+0avgdata
62192maxresident)k
0inputs+32outputs (0major+7066minor)pagefaults 0swaps
$
$ time clang-3.3 -O3 reduced.c
225.18user 0.09system 5:40.19elapsed 66%CPU (0avgtext+0avgdata
58640maxresident)k
0inputs+32outputs (0major+6803minor)pagefaults 0swaps

$ time gcc-trunk -O3 reduced.c
0.03user 0.00system 0:00.13elapsed 32%CPU (0avgtext+0avgdata 45024maxresident)k
0inputs+32outputs (0major+7113minor)pagefaults 0swaps
$
$ time icc -O3 reduced.c
0.24user 1.94system 0:03.80elapsed 57%CPU (0avgtext+0avgdata 81392maxresident)k
0inputs+192outputs (0major+16473minor)pagefaults 0swaps

$

------------------------------------------


char c;
static char *z = &c;

int a, b, g, *m, n, *w = &n, **x = &w;

volatile unsigned int d, *u = &d, **v = &u;

short sum (short p1, short p2)
{
  return p1 + p2;
}

unsigned int
foo (int p1)
{
  m = &p1;
  return a; 
}

short bar (short p1, short p2, unsigned p3)
{
  unsigned t1 = 0;
  unsigned short t2 = 0;
  for (n = 0; n < 4; ++n)
    {
      int i = t2--;
      if (*z < t2)
    return **x;
      for (g = 0; g < 13; g = sum (g, 1))
    for (i = 0; i < 39; i++)
      {
        t1 = foo (p2);
        t1 = (p3 <= t1) || d;
      }
    }
  return p1;
}

static short
baz ()
{
  short t3 = 0;
  int t4 = 0;
  int *t5 = &t4;
  for (b = 0; b < 4; b++)
    {
      int t6 = 1;
      t3 = bar (*t5, t6, t6);
      bar (t3, t6, *t5);
    }
  return **x;
}

int
main ()
{
  baz ();
  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>