https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77445
Bug ID: 77445 Summary: [7 Regression] Performance drop after r239219 on coremark test Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: ysrumyan at gmail dot com Target Milestone: --- We noticed huge (32%) performance drop on coremark-pro/core (former coremark benchmark) after http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=239219 The problem part is if (optimize_edge_for_speed_p (taken_edge)) which does not look correct since we have a lot of missed opportunities for jump threading optimization like: test.c.111t.thread2:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.111t.thread2:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.111t.thread2:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.111t.thread2:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.111t.thread2:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.111t.thread2:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.111t.thread2:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.111t.thread2:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.111t.thread2:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.167t.thread3:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 5 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. test.c.170t.thread4:FSM jump-thread path not considered: duplication of 4 insns is needed and optimizing for size. If we change it to if (!optimize_function_for_size_p (cfun)) performance is back. I attach the test-case to reproduce issue.