public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wmi at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/57459] [4.8/4.9 Regression] LRA inheritance bug
Date: Thu, 06 Jun 2013 22:18:00 -0000	[thread overview]
Message-ID: <bug-57459-4-CgNsEiXsKG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57459-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from wmi at google dot com ---
continue the analysis in the first post, for the smallcase 1.c, the IR after
calling inherit_in_ebb in lra_inheritance for bb12 is:

(insn 289 47 48 12 (set (reg:SI 116 [79])
        (reg:SI 121 [79])) 1.c:16 85 {*movsi_internal}
     (nil))
(insn 48 289 290 12 (set (reg:SI 116 [79])
        (if_then_else:SI (eq (reg:CCNO 17 flags)
                (const_int 0 [0]))
            (reg:SI 122 [83])
            (reg:SI 116 [79]))) 1.c:16 923 {*movsicc_noc}
     (expr_list:REG_DEAD (reg:SI 122 [83])
        (nil)))
(insn 290 48 294 12 (set (reg:SI 120 [79])
        (reg:SI 116 [79])) 1.c:16 85 {*movsi_internal}
     (nil))
(insn 294 290 49 12 (set (reg:SI 79)
        (reg:SI 120 [79])) 1.c:16 85 {*movsi_internal}
     (nil))
......
(insn 292 50 51 12 (set (reg:QI 118)
        (subreg:QI (reg:SI 120 [79]) 0)) 1.c:16 87 {*movqi_internal}
     (nil))
(insn 51 292 52 12 (parallel [
            (set (reg:CC 17 flags)
                (unspec:CC [
                        (subreg:QI (reg:SI 79) 0)
                        (reg:QI 118)
                    ] UNSPEC_ADD_CARRY))
            (set (subreg:QI (reg:SI 79) 0)
                (plus:QI (subreg:QI (reg:SI 79) 0)It is still correct 
                    (reg:QI 118)))
        ]) 1.c:16 259 {addqi3_cc}
     (expr_list:REG_UNUSED (reg:SI 79)
        (nil)))

The IR is still correct after this step. 

However, after update_ebb_live_info (called after inherit_in_ebb), insn 294 is
removed. Then reg 79 cannot get updated value and it doesn't equal to reg 118
anymore. IR is wrong after this step. 
insn 294 is removed in update_ebb_live_info because the reg type of reg 79 is
OP_INOUT but update_ebb_live_info only marks OP_IN type reg as live_regs.

So the fix is:
Index: gcc/lra-constraints.c
===================================================================
--- gcc/lra-constraints.c    (revision 199752)
+++ gcc/lra-constraints.c    (working copy)
@@ -4545,7 +4545,7 @@ update_ebb_live_info (rtx head, rtx tail
       bitmap_clear_bit (&live_regs, reg->regno);
       /* Mark each used value as live.  */
       for (reg = curr_id->regs; reg != NULL; reg = reg->next)
-    if (reg->type == OP_IN
+    if ((reg->type == OP_IN || reg->type == OP_INOUT)
         && bitmap_bit_p (&check_only_regs, reg->regno))
       bitmap_set_bit (&live_regs, reg->regno);
       /* It is quite important to remove dead move insns because it

Bootstrapped and tested on x86_64-linux.


  parent reply	other threads:[~2013-06-06 22:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29 21:26 [Bug rtl-optimization/57459] New: " wmi at google dot com
2013-05-29 21:36 ` [Bug rtl-optimization/57459] " ppluzhnikov at google dot com
2013-05-29 21:41 ` [Bug rtl-optimization/57459] [4.8/4.9 Regression] " pinskia at gcc dot gnu.org
2013-05-31 10:59 ` jakub at gcc dot gnu.org
2013-06-05 17:16 ` ppluzhnikov at google dot com
2013-06-05 19:03 ` pinskia at gcc dot gnu.org
2013-06-06 15:01 ` mikpe at it dot uu.se
2013-06-06 22:18 ` wmi at google dot com [this message]
2013-06-07  7:57 ` [Bug rtl-optimization/57459] [4.8 " jakub at gcc dot gnu.org
2013-08-13  9:40 ` jakub at gcc dot gnu.org
2013-08-14 14:16 ` vmakarov at gcc dot gnu.org
2013-08-14 14:18 ` jakub at gcc dot gnu.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-57459-4-CgNsEiXsKG@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).