public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: David Edelsohn <dje.gcc@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFA] expand from SSA form (1/2)
Date: Wed, 29 Apr 2009 12:48:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.0904291419220.29566@wotan.suse.de> (raw)
In-Reply-To: <303e1d290904281815q5cbbdedet74260a6437d1942c@mail.gmail.com>

Hi David,

On Tue, 28 Apr 2009, David Edelsohn wrote:

> decl_init_priority_lookup() appears to be setting the wrong value:
> 
> 0x1002af64 <decl_init_priority_lookup+56>:      li      r0,-1 <------------

Thanks!  That was very helpful.  It's another case of RTL constants 
handled incorrectly because they are modeless :-(  I've modifed Andreas' 
patch somewhat to take care of this, see below.  The important change from 
his patch is the hunk in insert_value_copy_on_edge().

I'm regstrapping this currently on x86_64-linux and powerpc64-linux (plus 
the fix for PR39955).


Ciao,
Michael.
-- 
Index: tree-outof-ssa.c
===================================================================
--- tree-outof-ssa.c	(revision 146952)
+++ tree-outof-ssa.c	(working copy)
@@ -128,6 +128,25 @@ set_location_for_edge (edge e)
     }
 }
 
+/* Emit insns to copy SRC into DEST converting SRC if necessary.  */
+
+static inline rtx
+emit_partition_copy (rtx dest, rtx src, int unsignedsrcp)
+{
+  rtx seq;
+
+  start_sequence ();
+
+  if (GET_MODE (src) != VOIDmode && GET_MODE (src) != GET_MODE (dest))
+    src = convert_to_mode (GET_MODE (dest), src, unsignedsrcp);
+  emit_move_insn (dest, src);
+
+  seq = get_insns ();
+  end_sequence ();
+
+  return seq;
+}
+
 /* Insert a copy instruction from partition SRC to DEST onto edge E.  */
 
 static void
@@ -149,12 +168,10 @@ insert_partition_copy_on_edge (edge e, i
 
   set_location_for_edge (e);
 
-  /* Partition copy between same base variables only, so it's the same mode,
-     hence we can use emit_move_insn.  */
-  start_sequence ();
-  emit_move_insn (SA.partition_to_pseudo[dest], SA.partition_to_pseudo[src]);
-  seq = get_insns ();
-  end_sequence ();
+  seq = emit_partition_copy (SA.partition_to_pseudo[dest],
+			     SA.partition_to_pseudo[src],
+			     TYPE_UNSIGNED (TREE_TYPE (
+			       partition_to_var (SA.map, src))));
 
   insert_insn_on_edge (seq, e);
 }
@@ -166,7 +183,6 @@ static void
 insert_value_copy_on_edge (edge e, int dest, tree src)
 {
   rtx seq, x;
-  enum machine_mode mode;
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       fprintf (dump_file,
@@ -186,6 +202,10 @@ insert_value_copy_on_edge (edge e, int d
   x = expand_expr (src, SA.partition_to_pseudo[dest], mode, EXPAND_NORMAL);
   if (GET_MODE (x) != VOIDmode && GET_MODE (x) != mode)
     x = convert_to_mode (mode, x, TYPE_UNSIGNED (TREE_TYPE (src)));
+  if (CONSTANT_P (x) && GET_MODE (x) == VOIDmode
+      && mode != TYPE_MODE (TREE_TYPE (src)))
+    x = convert_modes (mode, TYPE_MODE (TREE_TYPE (src)),
+			  x, TYPE_UNSIGNED (TREE_TYPE (src)));
   if (x != SA.partition_to_pseudo[dest])
     emit_move_insn (SA.partition_to_pseudo[dest], x);
   seq = get_insns ();
@@ -198,7 +218,7 @@ insert_value_copy_on_edge (edge e, int d
    onto edge E.  */
 
 static void
-insert_rtx_to_part_on_edge (edge e, int dest, rtx src)
+insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp)
 {
   rtx seq;
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -214,11 +234,9 @@ insert_rtx_to_part_on_edge (edge e, int
   gcc_assert (SA.partition_to_pseudo[dest]);
   set_location_for_edge (e);
 
-  start_sequence ();
-  gcc_assert (GET_MODE (src) == GET_MODE (SA.partition_to_pseudo[dest]));
-  emit_move_insn (SA.partition_to_pseudo[dest], src);
-  seq = get_insns ();
-  end_sequence ();
+  seq = emit_partition_copy (SA.partition_to_pseudo[dest],
+			     src,
+			     unsignedsrcp);
 
   insert_insn_on_edge (seq, e);
 }
@@ -243,11 +261,10 @@ insert_part_to_rtx_on_edge (edge e, rtx
   gcc_assert (SA.partition_to_pseudo[src]);
   set_location_for_edge (e);
 
-  start_sequence ();
-  gcc_assert (GET_MODE (dest) == GET_MODE (SA.partition_to_pseudo[src]));
-  emit_move_insn (dest, SA.partition_to_pseudo[src]);
-  seq = get_insns ();
-  end_sequence ();
+  seq = emit_partition_copy (dest,
+			     SA.partition_to_pseudo[src],
+			     TYPE_UNSIGNED (TREE_TYPE (
+			       partition_to_var (SA.map, src))));
 
   insert_insn_on_edge (seq, e);
 }
@@ -522,14 +539,17 @@ elim_create (elim_graph g, int T)
 
   if (elim_unvisited_predecessor (g, T))
     {
-      rtx U = get_temp_reg (partition_to_var (g->map, T));
+      tree var = partition_to_var (g->map, T);
+      rtx U = get_temp_reg (var);
+      int unsignedsrcp = TYPE_UNSIGNED (TREE_TYPE (var));
+
       insert_part_to_rtx_on_edge (g->e, U, T);
       FOR_EACH_ELIM_GRAPH_PRED (g, T, P, 
 	{
 	  if (!TEST_BIT (g->visited, P))
 	    {
 	      elim_backward (g, P);
-	      insert_rtx_to_part_on_edge (g->e, P, U);
+	      insert_rtx_to_part_on_edge (g->e, P, U, unsignedsrcp);
 	    }
 	});
     }

  reply	other threads:[~2009-04-29 12:39 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 14:15 David Edelsohn
2009-04-27 14:43 ` H.J. Lu
2009-04-27 15:08 ` Michael Matz
2009-04-27 15:11   ` David Edelsohn
2009-04-27 15:51     ` Michael Matz
2009-04-27 17:03       ` David Edelsohn
2009-04-27 17:27         ` David Edelsohn
2009-04-27 19:15       ` David Edelsohn
2009-04-28  0:48         ` Michael Matz
2009-04-28  0:54           ` Luis Machado
2009-04-28  1:22             ` Michael Matz
2009-04-28 13:24               ` Luis Machado
2009-04-30 17:55               ` Luis Machado
2009-05-01 19:33                 ` Richard Guenther
2009-05-04 13:38                   ` Luis Machado
2009-04-28 16:05           ` David Edelsohn
2009-04-28 16:19             ` Michael Matz
2009-04-28 23:49             ` Michael Matz
2009-04-29  5:50               ` David Edelsohn
2009-04-29 12:48                 ` Michael Matz [this message]
2009-04-29 13:21                   ` David Edelsohn
2009-04-29 13:35                     ` Michael Matz
2009-04-29 14:38                   ` David Edelsohn
2009-04-29 14:50                     ` Richard Guenther
2009-04-29 15:03                   ` Andreas Krebbel
2009-04-29 15:11                     ` Michael Matz
2009-04-29 15:40                       ` Andreas Krebbel
2009-04-29 17:33                         ` Michael Matz
2009-04-29 17:41                           ` Michael Matz
  -- strict thread matches above, loose matches on Subject: below --
2009-04-13 20:50 RFC: " Michael Matz
2009-04-21 18:23 ` Andrew MacLeod
2009-04-22 10:54   ` Michael Matz
2009-04-22 16:45     ` [RFA] " Michael Matz
2009-04-23 15:10       ` Andrew MacLeod
2009-04-24  9:42         ` Richard Guenther
2009-04-26 20:27         ` Michael Matz
2010-01-19 15:48           ` H.J. Lu
2009-04-24 14:32       ` Richard Guenther
2009-04-24 14:46         ` Richard Guenther
2009-04-26 20:21           ` Michael Matz
2009-04-26 20:34             ` Richard Guenther
2009-04-26 20:53               ` Michael Matz
2009-04-26 21:14                 ` Richard Guenther
2009-04-26 21:15                   ` Michael Matz
2009-04-26 21:17                     ` Richard Guenther
2009-04-26 22:21                       ` Michael Matz
2009-04-26 21:42             ` Michael Matz
2009-04-26 22:15               ` Michael Matz
2009-04-27 12:34             ` Michael Matz
2009-04-27  5:47       ` H.J. Lu
2009-04-28 23:49         ` H.J. Lu
2009-04-29  0:21           ` Andrew Pinski
2009-04-30 13:47           ` H.J. Lu
2009-05-29  3:47             ` H.J. Lu
2010-10-20 18:02               ` H.J. Lu
2011-02-14 18:02                 ` H.J. Lu
2009-04-27  7:22       ` Hans-Peter Nilsson
2009-04-30 18:18       ` Steve Ellcey
2009-05-01 17:40         ` Michael Matz

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=Pine.LNX.4.64.0904291419220.29566@wotan.suse.de \
    --to=matz@suse.de \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).