From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18398 invoked by alias); 29 Apr 2009 12:39:35 -0000 Received: (qmail 18386 invoked by uid 22791); 29 Apr 2009 12:39:32 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Apr 2009 12:39:23 +0000 Received: from relay2.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 025F393EE3; Wed, 29 Apr 2009 14:39:21 +0200 (CEST) Date: Wed, 29 Apr 2009 12:48:00 -0000 From: Michael Matz To: David Edelsohn Cc: gcc-patches Subject: Re: [RFA] expand from SSA form (1/2) In-Reply-To: <303e1d290904281815q5cbbdedet74260a6437d1942c@mail.gmail.com> Message-ID: References: <303e1d290904270711s4c3d9ec3k5c0307bd99b9c90@mail.gmail.com> <303e1d290904270807g2dc51773y79d7f5b3e5a92d2a@mail.gmail.com> <303e1d290904271112l68094dbeq370e75624a12b1b2@mail.gmail.com> <303e1d290904280836x5a4b2363ye022cec1a2cb999b@mail.gmail.com> <303e1d290904281815q5cbbdedet74260a6437d1942c@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg02327.txt.bz2 Hi David, On Tue, 28 Apr 2009, David Edelsohn wrote: > decl_init_priority_lookup() appears to be setting the wrong value: > > 0x1002af64 : 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); } }); }