Skip to content

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

Closed
@KavyaChopra04

Description

@KavyaChopra04

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions