This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][LRA] Fix PR87899: r264897 cause mis-compiled native arm-linux-gnueabihf toolchain
- From: Peter Bergner <bergner at linux dot ibm dot com>
- To: Renlin Li <renlin dot li at foss dot arm dot com>
- Cc: Jeff Law <law at redhat dot com>, Vladimir N Makarov <vmakarov at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Christophe Lyon <christophe dot lyon at linaro dot org>, Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>, Kyrylo Tkachov <kyrylo dot tkachov at arm dot com>, Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Date: Mon, 12 Nov 2018 14:25:06 -0600
- Subject: Re: [PATCH][LRA] Fix PR87899: r264897 cause mis-compiled native arm-linux-gnueabihf toolchain
- References: <04a0c117-8d96-3963-fdcd-fdd0467fa9f7@linux.ibm.com> <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. */