public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@linux.ibm.com>
To: Renlin Li <renlin.li@foss.arm.com>
Cc: Jeff Law <law@redhat.com>,
	Vladimir N Makarov <vmakarov@redhat.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>,
	       Christophe Lyon <christophe.lyon@linaro.org>,
	       Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	       Kyrylo Tkachov <kyrylo.tkachov@arm.com>,
	       Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Subject: Re: [PATCH][LRA] Fix PR87899: r264897 cause mis-compiled native arm-linux-gnueabihf toolchain
Date: Mon, 12 Nov 2018 20:25:00 -0000	[thread overview]
Message-ID: <49266acf-b128-1216-805f-0c46f9fb2c2a@linux.ibm.com> (raw)
In-Reply-To: <36df8c3c-37a9-e611-cc96-5fe2e111e396@foss.arm.com>

On 11/12/18 6:25 AM, Renlin Li wrote:
> I tried to build a native arm-linuxeabihf toolchain with the patch.
> But I got the following ICE:

Ok, the issue was a problem in handling the src reg from a register copy.
I thought I could just remove it from the dead_set, but forgot that the
updating of the program points looks at whether the pseudo is live or
not.  The change below on top of the previous patch fixes the ICE for me.
I now add the src reg back into pseudos_live before we process the insn's
input operands so it doesn't trigger a new program point being added.

Renlin and Jeff, can you apply this patch on top of the previous one
and see whether that is better?

Thanks.

Peter


--- gcc/lra-lives.c.orig	2018-11-12 14:15:18.257657911 -0600
+++ gcc/lra-lives.c	2018-11-12 14:08:55.978795092 -0600
@@ -934,6 +934,18 @@
 	  || sparseset_contains_pseudos_p (start_dying))
 	next_program_point (curr_point, freq);
 
+      /* If we removed the source reg from a simple register copy from the
+	 live set above, then add it back now so we don't accidentally add
+	 it to the start_living set below.  */
+      if (ignore_reg != NULL_RTX)
+	{
+	  int ignore_regno = REGNO (ignore_reg);
+	  if (HARD_REGISTER_NUM_P (ignore_regno))
+	    SET_HARD_REG_BIT (hard_regs_live, ignore_regno);
+	  else
+	    sparseset_set_bit (pseudos_live, ignore_regno);
+	}
+
       sparseset_clear (start_living);
 
       /* Mark each used value as live.	*/
@@ -959,11 +971,6 @@
 
       sparseset_and_compl (dead_set, start_living, start_dying);
 
-      /* If we removed the source reg from a simple register copy from the
-	 live set, then it will appear to be dead, but it really isn't.  */
-      if (ignore_reg != NULL_RTX)
-	sparseset_clear_bit (dead_set, REGNO (ignore_reg));
-
       sparseset_clear (start_dying);
 
       /* Mark early clobber outputs dead.  */

  parent reply	other threads:[~2018-11-12 20:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12  4:34 Peter Bergner
2018-11-12 12:26 ` Renlin Li
2018-11-12 15:33   ` Peter Bergner
2018-11-12 16:26     ` Renlin Li
2018-11-12 20:25   ` Peter Bergner [this message]
2018-11-13 15:01     ` Renlin Li
2018-11-13 15:53       ` Peter Bergner
2018-11-13 22:09         ` Vladimir Makarov
2018-11-13 22:18           ` Peter Bergner
2018-11-14  8:27             ` Christophe Lyon

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=49266acf-b128-1216-805f-0c46f9fb2c2a@linux.ibm.com \
    --to=bergner@linux.ibm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=christophe.lyon@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=law@redhat.com \
    --cc=renlin.li@foss.arm.com \
    --cc=vmakarov@redhat.com \
    /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).