[Bug middle-end/54154] cprop_hardreg generates redundant instructions

2012-08-02 Thread Paulo.Matos at csr dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54154

--- Comment #5 from Paulo J. Matos Paulo.Matos at csr dot com 2012-08-02 
09:34:03 UTC ---
I have now a patch for this which I will submit shortly.


[Bug middle-end/54154] cprop_hardreg generates redundant instructions

2012-08-02 Thread Paulo.Matos at csr dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54154

--- Comment #6 from Paulo J. Matos Paulo.Matos at csr dot com 2012-08-02 
09:58:55 UTC ---
Created attachment 27926
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27926
regcprop patch to remove redundant moves

This patch seems to fix 54154.
I am not sure its generic enough to make it straight into GCC but it works with
our port and I ran all the tests I have access to without any regressions.

With send it to gcc-patches.


[Bug middle-end/54154] cprop_hardreg generates redundant instructions

2012-08-02 Thread Paulo.Matos at csr dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54154

--- Comment #7 from Paulo J. Matos Paulo.Matos at csr dot com 2012-08-02 
10:05:40 UTC ---
(In reply to comment #6)
 With send it to gcc-patches.

's/With/Will/'


[Bug middle-end/54154] cprop_hardreg generates redundant instructions

2012-08-01 Thread Paulo.Matos at csr dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54154

--- Comment #1 from Paulo J. Matos Paulo.Matos at csr dot com 2012-08-01 
14:34:48 UTC ---
Created attachment 27923
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27923
After cprop_hardreg


[Bug middle-end/54154] cprop_hardreg generates redundant instructions

2012-08-01 Thread Paulo.Matos at csr dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54154

--- Comment #2 from Paulo J. Matos Paulo.Matos at csr dot com 2012-08-01 
14:37:53 UTC ---
Created attachment 27924
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27924
Add debug info when redundant insn is going to be generated

Looking at the gcc log header after running cprop_hardreg shows:

rescanning insn with uid = 14.
deleting insn with uid = 14.
insn 14: replaced reg 0 with 1
insn 48: replaced reg 0 with 1
rescanning insn with uid = 48.
deleting insn with uid = 48.
rescanning insn with uid = 5.
deleting insn with uid = 5.
oops, substitution makes dest same as src
insn 5: replaced reg 0 with 1


[Bug middle-end/54154] cprop_hardreg generates redundant instructions

2012-08-01 Thread Paulo.Matos at csr dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54154

Paulo J. Matos Paulo.Matos at csr dot com changed:

   What|Removed |Added

   Severity|normal  |enhancement

--- Comment #3 from Paulo J. Matos Paulo.Matos at csr dot com 2012-08-01 
15:00:34 UTC ---
OK, so I just noted this is not really a bug but a missed optimization:
/* Assert that SRC has been copied to DEST.  Adjust the data structures to
reflect that SRC contains an older copy of the shared value.  */

static void
copy_value (rtx dest, rtx src, struct value_data *vd)
{
  unsigned int dr = REGNO (dest);
  unsigned int sr = REGNO (src);
  unsigned int dn, sn;
  unsigned int i;

  /* ??? At present, it's possible to see noop sets.  It'd be nice if this were
cleaned up beforehand...  */
  if (sr == dr)
return;




[Bug middle-end/54154] cprop_hardreg generates redundant instructions

2012-08-01 Thread Paulo.Matos at csr dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54154

--- Comment #4 from Paulo J. Matos Paulo.Matos at csr dot com 2012-08-01 
15:01:29 UTC ---
Due to my last comment I marked this as a request for enhancement.