[PATCH] fix hardreg_cprop to honor HARD_REGNO_MODE_OK.

Jeff Law law@redhat.com
Fri Oct 10 23:10:00 GMT 2014


On 09/26/14 09:31, Ilya Tocar wrote:



>>
>> It's not a question of performance, but of design.
> Obviously, but I still fail to see why honoring HARD_REGNO_MODE_OK is
> bad design. I suspect that even without avx512 changes not honoring it will
> bite us sooner or later.
If we look at maybe_mode_change:

/* Register REGNO was originally set in ORIG_MODE.  It - or a copy of it -
    was copied in COPY_MODE to COPY_REGNO, and then COPY_REGNO was accessed
    in NEW_MODE.
    Return a NEW_MODE rtx for REGNO if that's OK, otherwise return 
NULL_RTX.  */

static rtx
maybe_mode_change (enum machine_mode orig_mode, enum machine_mode copy_mode,
                    enum machine_mode new_mode, unsigned int regno,
                    unsigned int copy_regno ATTRIBUTE_UNUSED)
{
   if (GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (orig_mode)
       && GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (new_mode))
     return NULL_RTX;

   if (orig_mode == new_mode)
     return gen_rtx_raw_REG (new_mode, regno);

REGNO was originally set in ORIG_MODE, that's an invariant of this 
fucntion.  ORIG_MODE == NEW_MODE in the conditional which generates the 
new reg.  How in the world can HARD_REGNO_MODE_OK be false in that case?

If it was false in that case, then how in the world did a value get put 
in REGNO using ORIG_MODE/NEW_MODE to start with?!?

It really looks like you're papering over a problem.

Jeff



More information about the Gcc-patches mailing list