https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68664
--- Comment #24 from Segher Boessenkool <segher at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #23) > > > Also with profile feedback perhaps you have enough info to tell that the > > > speculative path is almost as likely as the original placement. > > > > Maybe. The gain will be tiny though, afaics. > > Usually profile is useful while driving speculation. I would add an > param that prevents moving insn when bb->count or bb->frequency increases > by large amount (like 100 times). Speculatively executing insn that will > be ignored 99% of times is probably not paying back... > Without profile that will probably only trigger for paths leading to abort() > or similar cases, but with profiles that may hit quite common scenarios. There already is a param for this: min-spec-prob. The default is 40%, i.e. insns are not speculated into predecessor blocks if that pred bb has a frequency more than 2.5x larger than the bb the insn is from. In the testcase (with estimated profile) the prob is 67%, the freq is 1.5x, and that is already hugely noticeable.