Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extremely slow compilation at -O3 than -O2 (~400 seconds vs. ~0.1 seconds) #16848

Closed
zhendongsu opened this issue Jun 27, 2013 · 6 comments
Closed
Labels
bugzilla Issues migrated from bugzilla clang:codegen

Comments

@zhendongsu
Copy link

Bugzilla Link 16474
Resolution FIXED
Resolved on Nov 03, 2013 12:38
Version trunk
OS All
CC @d0k,@isanbard

Extended Description

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

@d0k
Copy link
Member

d0k commented Jun 29, 2013

Two issues here:

  1. We create thousands of dead lifetime.start/lifetime.end pairs. Maybe some pass should clean them up.
  2. PointerMayBeCaptured has a loophole in enforcing the threshold on number of uses when it encounters a switch instruction.

@d0k
Copy link
Member

d0k commented Oct 3, 2013

*** Bug llvm/llvm-bugzilla-archive#17461 has been marked as a duplicate of this bug. ***

@d0k
Copy link
Member

d0k commented Oct 3, 2013

Fixed issue #​2 in r191896, compile time should be down to "normal" levels now.

@isanbard
Copy link
Contributor

isanbard commented Nov 3, 2013

Please file a new bug about the dead lifetime markers.

@d0k
Copy link
Member

d0k commented Nov 3, 2013

Please file a new bug about the dead lifetime markers.

Bug 17790

@d0k
Copy link
Member

d0k commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#17461

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:codegen
Projects
None yet
Development

No branches or pull requests

3 participants