This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/70484] Wrong optimization with aliasing and access via char


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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's DSE1 that does this.

trying to replace QImode load in insn 9 from SImode store in insn 7
deferring rescan insn with uid = 9.
deferring rescan insn with uid = 17.
 -- replaced the loaded MEM with (reg 92)


      else if (s_info->rhs)
        /* Need to see if it is possible for this store to overwrite
           the value of store_info.  If it is, set the rhs to NULL to
           keep it from being used to remove a load.  */
        {
          if (canon_true_dependence (s_info->mem,
                                     GET_MODE (s_info->mem),
                                     s_info->mem_addr,
                                     mem, mem_addr))
            {
              s_info->rhs = NULL;
              s_info->const_rhs = NULL;
            }

it shouldn't use true_dependence but output_dependence (canon_output_dependence
is missing but trivial to add).

So the following patch fixes it.

Index: gcc/dse.c
===================================================================
--- gcc/dse.c   (revision 234663)
+++ gcc/dse.c   (working copy)
@@ -1609,10 +1609,7 @@ record_store (rtx body, bb_info_t bb_inf
           the value of store_info.  If it is, set the rhs to NULL to
           keep it from being used to remove a load.  */
        {
-         if (canon_true_dependence (s_info->mem,
-                                    GET_MODE (s_info->mem),
-                                    s_info->mem_addr,
-                                    mem, mem_addr))
+         if (output_dependence (s_info->mem, mem))
            {
              s_info->rhs = NULL;
              s_info->const_rhs = NULL;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]