[PATCH] Improve bswap on nop non-base_addr reshuffles (PR tree-optimization/81396)

Jakub Jelinek jakub@redhat.com
Fri Jul 14 08:56:00 GMT 2017


On Fri, Jul 14, 2017 at 09:45:39AM +0100, Thomas Preudhomme wrote:
> > +  else if (!bswap)
> > +    {
> 
> Would it make sense to add an assert right here checking that this is a
> cmpnop operation?

The earlier bswap_replace code to handle n->base_addr && !bswap doesn't
have anything like that either.

And the assert would be certainly non-trivial, like:
#if ENABLE_ASSERT_CHECKING
  uint64_t cmpnop = CMPNOP;
  /* Note, n->range has been multiplied by BITS_PER_UNIT in between, so it
     needs to be divided by it again.  */
  if (n->range / BITS_PER_UNIT < (int) sizeof (int64_t))
    {
      mask = ((uint64_t) 1 << (n->range / BITS_PER_UNIT * BITS_PER_MARKER)) - 1;
      cmpnop &= mask;
    }
  gcc_assert (n->n == cmpnop);
#endif

I think trusting find_bswap_or_nop did the job right is enough.

	Jakub



More information about the Gcc-patches mailing list