[Bug c++/66520] bad code generated code for branches with single &

fkastrati at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jun 14 10:44:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66520

--- Comment #4 from Fisnik <fkastrati at gmail dot com> ---
(In reply to Eric Botcazou from comment #3)
> > There should be at least some flag available, such that we can set such a
> > flag and have the compiler generate only a single jump for the method with
> > single ampersand.
> 
> You missed the point though, the compiler should generate the same code in
> both cases.  Whether or not it's the branchy form is another debate, which
> cannot be settled with toy examples like this one but by using real-life
> benchmarks.

Compiler should not generate the same code, and should listen to the developer,
when she/he connects predicates with single `&'. I already wrote that I did
benchmarks, and also mentioned a paper from a top computer science conference
(which I see you didn't even bother to read it) which has all the evidence
required.
The branch misprediction penalty for the assembly code with two jumps is simply
too severe when the selectivity of a predicate is around 0.5. 
And I also mentioned it that Intel's compiler is catching this very well. The
example was given just to point the problem, I cannot possibly write you here
10k lines of code of my project.



More information about the Gcc-bugs mailing list