public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch to fix a bug in LRA inheritance
@ 2014-07-11 17:21 Vladimir Makarov
  0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2014-07-11 17:21 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

The following patch fixes a bug in LRA inheritance found on compiling a 
big file on s390x.  Unfortunately, the bug is very hard to reproduce and 
the test is too big and can not be included.  But even if it were 
included, checking a correct code generation would be a problem too.

The bug was in undoing inheritance transformation.  Not all inheritance 
pseudo occurrences were removed which resulted in reading a garbage from 
memory.

The patch was successfully bootstrapped and tested on x86-64.

Committed to the trunk as rev. 212464.

2014-07-11  Vladimir Makarov  <vmakarov@redhat.com>

         * lra-constraints.c (remove_inheritance_pseudos): Process
         destination pseudo too.


[-- Attachment #2: z --]
[-- Type: text/plain, Size: 1025 bytes --]

Index: lra-constraints.c
===================================================================
--- lra-constraints.c	(revision 212460)
+++ lra-constraints.c	(working copy)
@@ -5697,6 +5697,20 @@ remove_inheritance_pseudos (bitmap remov
 			SUBREG_REG (SET_SRC (set)) = SET_SRC (prev_set);
 		      else
 			SET_SRC (set) = SET_SRC (prev_set);
+		      /* As we are finishing with processing the insn
+			 here, check the destination too as it might
+			 inheritance pseudo for another pseudo.  */
+		      if (bitmap_bit_p (remove_pseudos, dregno)
+			  && bitmap_bit_p (&lra_inheritance_pseudos, dregno)
+			  && (restore_regno
+			      = lra_reg_info[dregno].restore_regno) >= 0)
+			{
+			  if (GET_CODE (SET_DEST (set)) == SUBREG)
+			    SUBREG_REG (SET_DEST (set))
+			      = regno_reg_rtx[restore_regno];
+			  else
+			    SET_DEST (set) = regno_reg_rtx[restore_regno];
+			}
 		      lra_push_insn_and_update_insn_regno_info (curr_insn);
 		      lra_set_used_insn_alternative_by_uid
 			(INSN_UID (curr_insn), -1);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-07-11 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-11 17:21 Patch to fix a bug in LRA inheritance Vladimir Makarov

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).