This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][RTL ifcvt] PR rtl-optimization/71594: ICE in noce_emit_cmove due to mismatched source modes


Ping.
https://gcc.gnu.org/ml/gcc-patches/2016-06/msg01731.html

Thanks,
Kyrill

On 24/06/16 09:32, Kyrill Tkachov wrote:
Hi all,

In this PR we get an ICE when trying to emit a conditional move through noce_convert_multiple_sets.
The comment in the patch explains the situation but we get a two-instruction sequence like:
(insn 20 19 21 3 (set (reg:SI 89 [ _5 ])
        (reg:SI 88 [ _4 ])) wice.c:8 82 {*movsi_internal}
     (nil))
(insn 21 20 25 3 (set (reg:HI 90 [ a_lsm.10 ])
        (subreg:HI (reg:SI 89 [ _5 ]) 0)) wice.c:8 84 {*movhi_internal}
     (nil))

The first instruction feeds the second, but the second takes the lowpart subreg of the first destination.
This leads to the noce_emit_cmove call taking as arguments the first SImode destination and the second HImode
destination.  This causes an assertion failure deeper down the line.

The solution in this patch is catch this case and wrap the first destination in a lowpart subreg so that the two
operands of the cmove have the same mode.

Bootstrapped and tested on aarch64-none-linux-gnu, arm-none-linux-gnueabihf and x86_64-unknown-linux-gnu.

Ok for trunk?

Thanks,
Kyrill

2016-06-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    PR rtl-optimization/71594
    * ifcvt.c (noce_convert_multiple_sets): Wrap new_val or old_val
    into subregs of appropriate mode before trying to emit a conditional
    move.

2016-06-24  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    PR rtl-optimization/71594
    * gcc.dg/torture/pr71594.c: New test.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]