public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ibolton at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/45051] [4.6 Regression]: gcc.c-torture/execute/builtins/abs-2.c and abs-3.c due to "track subwords of DImode allocnos"
Date: Wed, 22 Dec 2010 16:23:00 -0000	[thread overview]
Message-ID: <bug-45051-4-vMZ1HSZhrD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-45051-4@http.gcc.gnu.org/bugzilla/>

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

Ian Bolton <ibolton at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |ibolton at gcc dot gnu.org
         Resolution|FIXED                       |

--- Comment #7 from Ian Bolton <ibolton at gcc dot gnu.org> 2010-12-22 16:23:21 UTC ---
(In reply to comment #5)
> Assuming fixed and closing.  Please reopen if you still have a problem.

This patch has caused SpecCPU2000 Ammp to fail for ARM -O3 thumb.

I assume the patch was meant to prevent deletions that shouldn't occur.  This
might be what happens for the original symptomatic test, but I am now seeing
extra deletions that shouldn't happen for Ammp.

For example, without this patch, you get these insns somewhere in the ira dump
for mm_fv_update_nonbon() from rectmm.c:

 (insn 3163 3161 3164 107 rectmm.c:1041 (set (reg:SI 1 r1) 
    (plus:SI (reg:SI 1 r1) 
       (const_int 280 [0x118]))) 4 {*arm_addsi3} (nil))

 (insn 3164 3163 1730 107 rectmm.c:1041 (set (reg:SI 3 r3) 
    (reg:SI 1 r1)) 586 {*thumb2_movsi_vfp} (nil))

With the patch, you lose the add and just get this:

 (insn 3164 3161 1730 107 rectmm.c:1041 (set (reg:SI 3 r3)
    (reg:SI 1 r1)) 586 {*thumb2_movsi_vfp} (nil)) 

The incrementing of r1 is perfectly legitimate and useful and removing it is a
bug.  Other increments of r9, ip, r0 and r3 are also lost.

I think the issue might be that reg_mentioned_p() considers output registers to
have been "mentioned", whereas the refers_to_regno_p() does not consider an
output register to have been "referred to".  I can see the problem with only
using reg_mentioned_p() because it doesn't handle subregs, but there is also a
problem with only using refers_to_regno_p(), as we can see with this segfault
in Ammp.

I therefore wonder if the fix might be this:

Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c       (revision 168082)
+++ gcc/reload1.c       (working copy)
@@ -8395,7 +8395,8 @@ delete_output_reload (rtx insn, int j, i
       if (NOTE_INSN_BASIC_BLOCK_P (i1))
        return;
       if ((NONJUMP_INSN_P (i1) || CALL_P (i1))
-         && refers_to_regno_p (regno, regno + nregs, PATTERN (i1), NULL))
+         && (refers_to_regno_p (regno, regno + nregs, PATTERN (i1), NULL)
+             || reg_mentioned_p (reg, PATTERN (i1))))
        {
          /* If this is USE in front of INSN, we only have to check that
             there are no more references than accounted for by inheritance. 
*/

I am heading off for Christmas vacation shortly, so cannot look into this any
further, but I wanted to record my findings so far publicly.  Apologies if
there is missing information.  I return to work Jan 4th.


       reply	other threads:[~2010-12-22 16:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-45051-4@http.gcc.gnu.org/bugzilla/>
2010-12-22 16:23 ` ibolton at gcc dot gnu.org [this message]
2010-12-23  1:56 ` hp at gcc dot gnu.org
2010-12-23 14:29 ` hp at gcc dot gnu.org
2011-01-03 19:58 ` rguenth at gcc dot gnu.org
2011-01-03 20:01 ` rguenth at gcc dot gnu.org
2010-07-24  2:43 [Bug rtl-optimization/45051] New: " hp at gcc dot gnu dot org
2010-07-24  2:46 ` [Bug rtl-optimization/45051] " hp at gcc dot gnu dot org
2010-07-24  2:51 ` hp at gcc dot gnu dot org
2010-07-24  3:03 ` hp at gcc dot gnu dot org
2010-07-27  9:35 ` bernds at gcc dot gnu dot org
2010-07-27 21:49 ` bernds at gcc dot gnu dot org
2010-09-21 21:26 ` hp at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-45051-4-vMZ1HSZhrD@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).