http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59802
Bug ID: 59802 Summary: excessive compile time in loop unswitching Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Created attachment 31830 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31830&action=edit gzipped C++ source code I just compiled the attached code with gcc trunk 20140112 on a x86_64 box with flag -O3 and it took over eight minutes. Using only -O2 took a more reasonable 2 minutes 38 seconds. For reference, the redhat version of gcc 482 took 2 minutes 32 seconds for -O3 and 2 minutes 11 seconds for -O2. I can see that for -O2, trunk is using about 30 seconds more CPU time, which is fine, but for -O3 over 5 minutes more. I tried flag -ftime-report and here are all the times > 1%. Execution times (seconds) phase opt and generate : 465.18 (100%) usr 0.50 (57%) sys 468.04 (100%) wall 130935 kB (59%) ggc loop invariant motion : 22.50 ( 5%) usr 0.01 ( 1%) sys 22.85 ( 5%) wall 2 kB ( 0%) ggc loop unswitching : 302.37 (65%) usr 0.01 ( 1%) sys 303.82 (65%) wall 72 kB ( 0%) ggc CPROP : 85.02 (18%) usr 0.09 (10%) sys 85.52 (18%) wall 4445 kB ( 2%) ggc TOTAL : 466.12 0.88 469.55 221219 kB Suggest code rework for trunk for -O3, maybe in the area of loop unswitching. This bug may be a duplicate of bug 38518