public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] [PR104971] LRA: check live hard regs to remove a dead insn
@ 2022-03-25 16:31 Vladimir Makarov
  0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2022-03-25 16:31 UTC (permalink / raw)
  To: gcc-patches

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

The following patch is for

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971

The PR was already fixed by Jakub but his patch did not fix a latent LRA 
bug mentioned in the PR comments.  The current patch fixes the latent bug.

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


[-- Attachment #2: pr104971.patch --]
[-- Type: text/x-patch, Size: 1143 bytes --]

commit 33904327c92bd914d4e0e076be12dc0a6b453c2d
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Fri Mar 25 12:22:08 2022 -0400

    [PR104971] LRA: check live hard regs to remove a dead insn
    
    LRA removes insn modifying sp for given PR test set.  We should also have
    checked living hard regs to prevent this.  The patch fixes this.
    
    gcc/ChangeLog:
    
            PR middle-end/104971
            * lra-lives.cc (process_bb_lives): Check hard_regs_live for hard
            regs to clear remove_p flag.

diff --git a/gcc/lra-lives.cc b/gcc/lra-lives.cc
index 796f00629b4..a755464ee81 100644
--- a/gcc/lra-lives.cc
+++ b/gcc/lra-lives.cc
@@ -724,7 +724,10 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p)
 	  bool remove_p = true;
 
 	  for (reg = curr_id->regs; reg != NULL; reg = reg->next)
-	    if (reg->type != OP_IN && sparseset_bit_p (pseudos_live, reg->regno))
+	    if (reg->type != OP_IN
+		&& (reg->regno < FIRST_PSEUDO_REGISTER
+		    ? TEST_HARD_REG_BIT (hard_regs_live, reg->regno)
+		    : sparseset_bit_p (pseudos_live, reg->regno)))
 	      {
 		remove_p = false;
 		break;

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

only message in thread, other threads:[~2022-03-25 16:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25 16:31 [committed] [PR104971] LRA: check live hard regs to remove a dead insn 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).