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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to denis.campredon from comment #13)
> Thanks a lots.
> 
> I have a question though: foo and bar are similar, foo produces a branchless
> code whereas bar uses a jump.
> 
> int foo(int i) {
>     return !i ? 0 : -2;
> }
> 
> int bar(int i) {
>     return i ? -2 : 0;
> }
> 
> If I'm readding correctly in the two functions the probabilities are the
> same. Is this "normal" or worth a new ticket ?

There is the bug where cond_move_process_if_block ignores the costs and another
where if the cost checks are added, it might be worth for the destination
overlap with comparison operand case force the comparison operand or
destination into a new temporary and add one more first or last instead of
giving up.  The costs comparison would then catch that.
So yes, it is worth a new PR, but not something that will be addressed for GCC
12.

Reply via email to