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 middle-end/50448] [4.5/4.6/4.7 Regression] Missed optimization accessing struct component with integer address


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50448

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-10-28 12:59:28 UTC ---
The issue is still present for avr (4.7 trunk r180399).

There is a patch proposed by Paolo that fixes the issue:

Can someone of you integrate that patch? I have no access to compile farm and
cannot test for all languages/targets/hosts that might be affected.



Index: cprop.c
===================================================================
--- cprop.c    (revision 177688)
+++ cprop.c    (working copy)
@@ -764,6 +764,18 @@ try_replace_reg (rtx from, rtx to, rtx i
     note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
     }

+  if (set && MEM_P (SET_DEST (set)) && reg_mentioned_p (from, SET_DEST (set)))
+    {
+      /* If above failed and this is a single set, try to simplify the source
of
+     the set given our substitution.  We could perhaps try this for multiple
+     SETs, but it probably won't buy us anything.  */
+      rtx addr = simplify_replace_rtx (SET_DEST (set), from, to);
+
+      if (!rtx_equal_p (addr, SET_DEST (set))
+      && validate_change (insn, &SET_DEST (set), addr, 0))
+    success = 1;
+    }
+
   /* REG_EQUAL may get simplified into register.
      We don't allow that. Remove that note. This code ought
      not to happen, because previous code ought to synthesize


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