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; }
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.
*** Bug 17461 has been marked as a duplicate of this bug. ***
Fixed issue #2 in r191896, compile time should be down to "normal" levels now.
Please file a new bug about the dead lifetime markers.
(In reply to comment #4) > Please file a new bug about the dead lifetime markers. Bug 17790