https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102733
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:64ca6aa74b6b5a9737f3808bf4a947dd5c122d47 commit r14-1508-g64ca6aa74b6b5a9737f3808bf4a947dd5c122d47 Author: Andrew Pinski <apin...@marvell.com> Date: Thu Jun 1 21:17:56 2023 -0700 rtl-optimization: [PR102733] DSE removing address which only differ by address space. The problem here is DSE was not taking into account the address space which meant if you had two addresses say `fs:0` and `gs:0` (on x86_64), DSE would think they were the same and remove the first store. This fixes that issue by adding a check for the address space too. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR rtl-optimization/102733 gcc/ChangeLog: * dse.cc (store_info): Add addrspace field. (record_store): Record the address space and check to make sure they are the same. gcc/testsuite/ChangeLog: * gcc.target/i386/addr-space-6.c: New test.