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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
          Component|target                      |rtl-optimization
   Last reconfirmed|                            |2021-10-13
           Keywords|                            |wrong-code

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Gimple level is good:
  MEM[(<address-space-1> int *)0B] = 1;
  MEM[(<address-space-2> int *)0B] = 2;

Expansion seems to be correct (notice AS1 and AS2):
(insn 5 4 6 (set (reg/f:DI 82)
        (const_int 0 [0])) "/app/example.cpp":17:7 -1
     (nil))

(insn 6 5 0 (set (mem:SI (reg/f:DI 82) [1 MEM[(<address-space-1> int *)0B]+0 S4
A128 AS1])
        (const_int 1 [0x1])) "/app/example.cpp":17:7 -1
     (nil))

;; MEM[(<address-space-2> int *)0B] = 2;

(insn 7 6 8 (set (reg/f:DI 83)
        (const_int 0 [0])) "/app/example.cpp":20:7 -1
     (nil))

(insn 8 7 0 (set (mem:SI (reg/f:DI 83) [1 MEM[(<address-space-2> int *)0B]+0 S4
A128 AS2])
        (const_int 2 [0x2])) "/app/example.cpp":20:7 -1
     (nil))


RTL level DSE removes the first store.  I suspect dse.c does not check
ADDR_SPACE_GENERIC_P.

Reply via email to