https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389
Bug ID: 79389 Summary: 30% performance regression in SciMark2 MonteCarlo Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: krister.walfridsson at gmail dot com Target Milestone: --- Created attachment 40676 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40676&action=edit The relevant source code and generated assembler before/after this change The MonteCarlo test from the old SciMark2 (http://math.nist.gov/scimark) used in the Phoronix compiler test suite has regressed 30% compared to GCC 6.3 when run on Intel i7 6800K Broadwell (compiled with "-O3 -march=native"). The regression was introduced in r238005: ------------------------------------------------------------------------ r238005 | rguenth | 2016-07-05 15:25:47 +0200 (tis, 05 jul 2016) | 7 lines 2016-07-05 Richard Biener <rguent...@suse.de> * gimple-ssa-split-paths.c (find_block_to_duplicate_for_splitting_pa): Handle empty else block. (is_feasible_trace): Likewise. (split_paths): Likewise. ------------------------------------------------------------------------ and has the effect that the if-statement in the loop for (count=0; count<Num_samples; count++) { double x= Random_nextDouble(R); double y= Random_nextDouble(R); if ( x*x + y*y <= 1.0) under_curve ++; } is changed from a cmov to a branch, which mispredicts.