public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2916] cselib: Keep track of further subvalue relations
@ 2022-09-28 15:29 Stefan Schulze Frielinghaus
  0 siblings, 0 replies; only message in thread
From: Stefan Schulze Frielinghaus @ 2022-09-28 15:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d0b00b63a39108311f2e6f9cbe9072579f57df7c

commit r13-2916-gd0b00b63a39108311f2e6f9cbe9072579f57df7c
Author: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Date:   Wed Sep 28 17:27:11 2022 +0200

    cselib: Keep track of further subvalue relations
    
    Whenever a new cselib value is created check whether a smaller value
    exists which is contained in the bigger one.  If so add a subreg
    relation to locs of the smaller one.
    
    gcc/ChangeLog:
    
            * cselib.cc (new_cselib_val): Keep track of further subvalue
            relations.

Diff:
---
 gcc/cselib.cc | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gcc/cselib.cc b/gcc/cselib.cc
index 6a5609786fa..9b582e5d3d6 100644
--- a/gcc/cselib.cc
+++ b/gcc/cselib.cc
@@ -1569,6 +1569,26 @@ new_cselib_val (unsigned int hash, machine_mode mode, rtx x)
   e->locs = 0;
   e->next_containing_mem = 0;
 
+  scalar_int_mode int_mode;
+  if (REG_P (x) && is_int_mode (mode, &int_mode)
+      && REG_VALUES (REGNO (x)) != NULL
+      && (!cselib_current_insn || !DEBUG_INSN_P (cselib_current_insn)))
+    {
+      rtx copy = shallow_copy_rtx (x);
+      scalar_int_mode narrow_mode_iter;
+      FOR_EACH_MODE_UNTIL (narrow_mode_iter, int_mode)
+	{
+	  PUT_MODE_RAW (copy, narrow_mode_iter);
+	  cselib_val *v = cselib_lookup (copy, narrow_mode_iter, 0, VOIDmode);
+	  if (v)
+	    {
+	      rtx sub = lowpart_subreg (narrow_mode_iter, e->val_rtx, int_mode);
+	      if (sub)
+		new_elt_loc_list (v, sub);
+	    }
+	}
+    }
+
   if (dump_file && (dump_flags & TDF_CSELIB))
     {
       fprintf (dump_file, "cselib value %u:%u ", e->uid, hash);

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

only message in thread, other threads:[~2022-09-28 15:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 15:29 [gcc r13-2916] cselib: Keep track of further subvalue relations Stefan Schulze Frielinghaus

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