Ping.
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01966.html

Thanks,
Kyrill

On 21/12/15 09:23, Kyrill Tkachov wrote:

On 18/12/15 13:16, Bernd Schmidt wrote:
On 12/18/2015 02:07 PM, Kyrill Tkachov wrote:
In this PR we have a THEN and an ELSE block where one uses the condition
reg from the preceeding comparison
but the other block has an arithmetic operation that clobbers the CC reg.
ifcvt emits the latter first and dead code elimination later sees this
and eliminates the first comparison
because it sees that the CC reg is clobbered between the comparison and
its usage.

     (noce_try_cmove_arith): Check CC reg usage in both blocks
     and emit them in such an order so as not to clobber the CC reg
     before its use, if possible.

Why is this done here? It looks to me like bbs_ok_for_cmove_arith is the 
function that already tries to sort out issues like this. Does it maybe just 
need to be extended to see clobbers?


Here is a version integrating the new checks into bbs_ok_for_cmove_arith.
We might as well do it there since it already iterates over all the 
instructions in the basic blocks.

Bootstrapped and tested on arm, aarch64, x86_64 and checked that there are no 
codegen effects on SPEC2006.
How does this look?

Thanks,
Kyrill

2015-12-21  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

    PR rtl-optimization/68841
    * ifcvt.c (cond_exec_get_condition): Rename to...
    (get_condition_from_jump): ... This.
    (cond_exec_process_if_block): Update callsites.
    (dead_or_predicable): Likewise.
    (bbs_ok_for_cmove_arith): Update to record use and clobbers
    of the CC register.
    (noce_try_cmove_arith): Check CC reg usage in both blocks
    and emit them in such an order so as not to clobber the CC reg
    before its use, if possible.

2015-12-21  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

    PR rtl-optimization/68841
    * gcc.dg/pr68841.c: New test.

Reply via email to