]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/20466 (Missed invalidation of known memory contents in flow2...)
authorHans-Peter Nilsson <hp@axis.com>
Fri, 8 Apr 2005 23:21:07 +0000 (23:21 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Fri, 8 Apr 2005 23:21:07 +0000 (23:21 +0000)
PR rtl-optimization/20466
* flow.c (invalidate_mems_from_set): Handle a MEM by checking it
for overlap of the address of each list member.
(mark_set_1): Call invalidate_mems_from_set for MEMs too.

From-SVN: r97870

gcc/ChangeLog
gcc/flow.c

index 470e2215def817b525159e5c90b5d895c8cfc8ee..73ec69f286d1a1e7338cd66b05c5055a4ac8f885 100644 (file)
@@ -1,3 +1,10 @@
+2005-04-09  Hans-Peter Nilsson  <hp@axis.com>
+
+       PR rtl-optimization/20466
+       * flow.c (invalidate_mems_from_set): Handle a MEM by checking it
+       for overlap of the address of each list member.
+       (mark_set_1): Call invalidate_mems_from_set for MEMs too.
+
 2005-04-08  Mike Stump  <mrs@apple.com>
 
        * config/darwin.c (indirect_data): Fix typo in strncmp logic.
index bdd72d30f4ffac0354dd685251f1ab0260c18027..96aa436540e5816bf3f65f0cf2509a5e1f40a95f 100644 (file)
@@ -2530,7 +2530,8 @@ invalidate_mems_from_autoinc (rtx *px, void *data)
   return 0;
 }
 
-/* EXP is a REG.  Remove any dependent entries from pbi->mem_set_list.  */
+/* EXP is a REG or MEM.  Remove any dependent entries from
+   pbi->mem_set_list.  */
 
 static void
 invalidate_mems_from_set (struct propagate_block_info *pbi, rtx exp)
@@ -2542,7 +2543,12 @@ invalidate_mems_from_set (struct propagate_block_info *pbi, rtx exp)
   while (temp)
     {
       next = XEXP (temp, 1);
-      if (reg_overlap_mentioned_p (exp, XEXP (temp, 0)))
+      if ((REG_P (exp) && reg_overlap_mentioned_p (exp, XEXP (temp, 0)))
+         /* When we get an EXP that is a mem here, we want to check if EXP
+            overlaps the *address* of any of the mems in the list (i.e. not
+            whether the mems actually overlap; that's done elsewhere).  */
+         || (MEM_P (exp)
+             && reg_overlap_mentioned_p (exp, XEXP (XEXP (temp, 0), 0))))
        {
          /* Splice this entry out of the list.  */
          if (prev)
@@ -2748,11 +2754,12 @@ mark_set_1 (struct propagate_block_info *pbi, enum rtx_code code, rtx reg, rtx c
       break;
     }
 
-  /* If this set is a MEM, then it kills any aliased writes.
+  /* If this set is a MEM, then it kills any aliased writes and any
+     other MEMs which use it.
      If this set is a REG, then it kills any MEMs which use the reg.  */
   if (optimize && (flags & PROP_SCAN_DEAD_STORES))
     {
-      if (REG_P (reg))
+      if (REG_P (reg) || MEM_P (reg))
        invalidate_mems_from_set (pbi, reg);
 
       /* If the memory reference had embedded side effects (autoincrement