http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337
Bug #: 54337 Summary: Dramatic Compilation slow-down on higher Optimizaitons Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassig...@gcc.gnu.org ReportedBy: nbharg...@google.com Created attachment 28061 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28061 Test Case The attached file contains a few function definitions followed by a main method with a single line of code duplicated 2500 times. At optimization levels O0, the code compiles relatively quickly (~8s). However, at optimization levels O2 and O3, the compilation time jumps to over 30s to compile -- almost a 4x difference. Interesting things about what speeds up the optimized compilation: Having an if-statement with an empty body cuts down compilation times on all optimization levels to under 3s. This could be related to http://llvm.org/bugs/show_bug.cgi?id=13651, as the problem was discovered in a file that repeats a macro heavily, as these examples do.