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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-08-11
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |10.3
                 CC|                            |jakub at gcc dot gnu.org
          Component|c                           |tree-optimization
            Summary|[Regression] Regression in  |[10/11 Regression]
                   |optimization on x86-64 with |Regression in optimization
                   |-O3 from GCC 9 to 10        |on x86-64 with -O3

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Stopped being recognized as bswap with r274922.
That changed the IL before store-merging from
  _22 = MEM[(const uint8_t *)&pointer];
  MEM[(uint8_t *)&newPointer + 7B] = _22;
  _33 = MEM[(const uint8_t *)&pointer + 1B];
  MEM[(uint8_t *)&newPointer + 6B] = _33;
  _44 = MEM[(const uint8_t *)&pointer + 2B];
  MEM[(uint8_t *)&newPointer + 5B] = _44;
  _55 = MEM[(const uint8_t *)&pointer + 3B];
  MEM[(uint8_t *)&newPointer + 4B] = _55;
  _66 = MEM[(const uint8_t *)&pointer + 4B];
  MEM[(uint8_t *)&newPointer + 3B] = _66;
  _77 = MEM[(const uint8_t *)&pointer + 5B];
  MEM[(uint8_t *)&newPointer + 2B] = _77;
  _88 = MEM[(const uint8_t *)&pointer + 6B];
  MEM[(uint8_t *)&newPointer + 1B] = _88;
  _5 = MEM[(const uint8_t *)&pointer + 7B];
  MEM[(uint8_t *)&newPointer] = _5;
  _9 = newPointer;
  newPointer ={v} {CLOBBER};
  return _9;
to:
  _22 = BIT_FIELD_REF <pointer_36(D), 8, 0>;
  MEM[(uint8_t *)&newPointer + 7B] = _22;
  _33 = BIT_FIELD_REF <pointer_36(D), 8, 8>;
  MEM[(uint8_t *)&newPointer + 6B] = _33;
  _44 = BIT_FIELD_REF <pointer_36(D), 8, 16>;
  MEM[(uint8_t *)&newPointer + 5B] = _44;
  _55 = BIT_FIELD_REF <pointer_36(D), 8, 24>;
  MEM[(uint8_t *)&newPointer + 4B] = _55;
  _66 = BIT_FIELD_REF <pointer_36(D), 8, 32>;
  MEM[(uint8_t *)&newPointer + 3B] = _66;
  _77 = BIT_FIELD_REF <pointer_36(D), 8, 40>;
  MEM[(uint8_t *)&newPointer + 2B] = _77;
  _88 = BIT_FIELD_REF <pointer_36(D), 8, 48>;
  MEM[(uint8_t *)&newPointer + 1B] = _88;
  _5 = BIT_FIELD_REF <pointer_36(D), 8, 56>;
  MEM[(uint8_t *)&newPointer] = _5;
  _9 = newPointer;
  newPointer ={v} {CLOBBER};
  return _9;
store merging has code to handle this, but punts on non-integral types
(POINTER_TYPE_P in this case).
Just changing:
--- gcc/gimple-ssa-store-merging.c.jj   2020-07-28 15:39:09.909757589 +0200
+++ gcc/gimple-ssa-store-merging.c      2020-08-11 20:19:19.293299266 +0200
@@ -333,7 +333,8 @@ init_symbolic_number (struct symbolic_nu
 {
   int size;

-  if (! INTEGRAL_TYPE_P (TREE_TYPE (src)))
+  if (! INTEGRAL_TYPE_P (TREE_TYPE (src))
+      && ! POINTER_TYPE_P (TREE_TYPE (src)))
     return false;

   n->base_addr = n->offset = n->alias_set = n->vuse = NULL_TREE;
seems to work, though I must say I don't find much rationale for byte-swapping
pointers...

Reply via email to