[LLVMbugs] [Bug 16474] New: extremely slow compilation at -O3 than -O2 (~400 seconds vs. ~0.1 seconds)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 27 11:38:06 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16474

            Bug ID: 16474
           Summary: extremely slow compilation at -O3 than -O2 (~400
                    seconds vs. ~0.1 seconds)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code takes much longer to compile at -O3 than at -O2, using the
current clang-trunk and clang 3.3 on x86_64-linux. For additional reference,
gcc 4.8.1 at -O3 takes ~0.14 seconds, and icc 13.1.1 at -O3 takes ~3.4 seconds. 

It appears to be a regression from clang 3.2 (which takes about 9 seconds at
-O3).

% clang-trunk -v
clang version 3.4 (trunk 185061)
Target: x86_64-pc-linux-gnu
Thread model: posix
% time clang-trunk -O3 reduced.c

real    6m35.619s
user    4m56.983s
sys    0m0.080s
%
% time clang-trunk -O2 reduced.c

real    0m0.102s
user    0m0.028s
sys    0m0.008s
%
% time clang-3.2 -O3 reduced.c

real    0m9.003s
user    0m7.764s
sys    0m0.024s
%
% time gcc-4.8 -O3 reduced.c

real    0m0.138s
user    0m0.036s
sys    0m0.020s
%
% time icc -O3 reduced.c

real    0m3.374s
user    0m0.232s
sys    0m2.028s


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

int a = 1, b, c, *d = &c, e, f, g, k, l, x; 

static int * volatile *h = &d;
static int * volatile **j = &h;

void foo (int p) 
{
  d = &p;
}

void bar ()
{
  int i; 

  foo (0);
  for (i = 0; i < 27; ++i) 
    for (f = 0; f < 3; f++)  
      for (g = 0; g < 3; g++) 
    {
      for (b = 0; b < 3; b++)
        if (e)
          break;
      foo (0); 
    }
}

static void baz ()
{
  for (; a >= 0; a--) 
    for (k = 3; k > 0; k--)
      for (l = 0; l < 6; l++) 
    {
      bar (); 
      **j = &x; 
    }
}

int main ()
{
  baz ();
  return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130627/315ea78b/attachment.html>


More information about the llvm-bugs mailing list