Skip to content

Abnormally large compilation time with -O2 for a small file on x86_64-linux-gnu #135965

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

Closed
KavyaChopra04 opened this issue Apr 16, 2025 · 2 comments

Comments

@KavyaChopra04
Copy link

it seems to be a recent regression from 20.1.0

clang version 21.0.0git (https://github.com/llvm/llvm-project.git da17ced11b1cf44b433cb2b850978df4b6bff279)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/home/kchopra/llvm-project/build/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
kchopra@ast-epyc5:~$ time clangtk -O2 small.c

real	0m5.232s
user	0m5.189s
sys	0m0.035s
kchopra@ast-epyc5:~$ cat small
small             small.c           small.c.orig      small.o           small_fuzzed.csv  
kchopra@ast-epyc5:~$ cat small.
small.c       small.c.orig  small.o       
kchopra@ast-epyc5:~$ cat small.c
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p;
int main() {
  l = e;
  if (b * d >= 0)
    goto q;
  goto x;
r:
  if (d * e)
    goto s;
  l = f;
  goto t;
u:
  b = f;
  if (k)
    goto v;
w:
  if (d)
    goto r;
  goto aa;
y:
  if (e)
    goto v;
aa:
  n = g;
ab:
  if (g >= 0)
    goto ac;
t:
  if (h >= 0)
    goto ad;
s:
  if (n)
    goto ab;
  h = d;
  if (b * o)
    goto y;
ac:
  if (f)
    goto x;
  goto ae;
q:
  a = 1;
  if (f * o >= 0)
    goto ab;
  goto af;
v:
  e = j + 3;
  if (b)
    goto ag;
ah:
  goto ai;
ag:
  d = g + 2;
  if (g)
    goto u;
ad:
  if (f)
    goto ah;
af:
  c = h * g + b;
  if (i)
    goto r;
  o = d;
ai:
  if (a * b * o)
    goto w;
x:
  p = l + o;
ae:
  m = e * g;
  if (f * a)
    goto t;
}
@KavyaChopra04 KavyaChopra04 changed the title Abnormally large compilation time for a small file on x86_64-linux-gnu Abnormally large compilation time with -O2 for a small file on x86_64-linux-gnu Apr 16, 2025
@fhahn
Copy link
Contributor

fhahn commented Apr 23, 2025

@dianqk might be related to the the recent changes to TailDup for computed gotos?

@dianqk
Copy link
Member

dianqk commented Apr 26, 2025

I can bisect to #133091 and #134286.
cc @alexey-bataev

@alexey-bataev alexey-bataev self-assigned this Apr 27, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
…ts and small nodes with reuses

Improves compile time for non-profitable cases.
Fixes llvm#135965
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
…ts and small nodes with reuses

Improves compile time for non-profitable cases.
Fixes llvm#135965
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
…ts and small nodes with reuses

Improves compile time for non-profitable cases.
Fixes llvm#135965
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this issue May 9, 2025
…ts and small nodes with reuses

Improves compile time for non-profitable cases.
Fixes llvm#135965
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants