* PR61919: Invalid rtx sharing in tree-outof-ssa.c
@ 2014-07-27 18:02 Richard Sandiford
2014-07-28 8:03 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2014-07-27 18:02 UTC (permalink / raw)
To: gcc-patches
PR 61919 is another ripple from the patch to take advantage of rtx
sharing rules when instantiating virtual registers. In this case
the invalid sharing is coming from tree-outof-ssa.c, where the same
MEM rtx is being used in several moves. (Note that despite the name,
partition_to_pseudo maps to stack slot MEMs as well as pseudos.)
Tested on x86_64-linux-gnu. Also tested by Andreas on ia64,
where the testsuite regression showed up. OK to install?
Thanks,
Richard
gcc/
PR middle-end/61919
* tree-outof-ssa.c (insert_partition_copy_on_edge)
(insert_value_copy_on_edge, insert_rtx_to_part_on_edge)
(insert_part_to_rtx_on_edge): Copy partition_to_pseudo rtxes before
inserting them in the insn stream.
Index: gcc/tree-outof-ssa.c
===================================================================
--- gcc/tree-outof-ssa.c 2014-07-26 21:14:51.074755469 +0100
+++ gcc/tree-outof-ssa.c 2014-07-26 21:14:51.590759910 +0100
@@ -260,8 +260,8 @@ insert_partition_copy_on_edge (edge e, i
set_curr_insn_location (locus);
var = partition_to_var (SA.map, src);
- seq = emit_partition_copy (SA.partition_to_pseudo[dest],
- SA.partition_to_pseudo[src],
+ seq = emit_partition_copy (copy_rtx (SA.partition_to_pseudo[dest]),
+ copy_rtx (SA.partition_to_pseudo[src]),
TYPE_UNSIGNED (TREE_TYPE (var)),
var);
@@ -274,7 +274,7 @@ insert_partition_copy_on_edge (edge e, i
static void
insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
{
- rtx seq, x;
+ rtx dest_rtx, seq, x;
enum machine_mode dest_mode, src_mode;
int unsignedp;
tree var;
@@ -289,7 +289,8 @@ insert_value_copy_on_edge (edge e, int d
fprintf (dump_file, "\n");
}
- gcc_assert (SA.partition_to_pseudo[dest]);
+ dest_rtx = copy_rtx (SA.partition_to_pseudo[dest]);
+ gcc_assert (dest_rtx);
set_location_for_edge (e);
/* If a locus is provided, override the default. */
@@ -300,9 +301,9 @@ insert_value_copy_on_edge (edge e, int d
var = SSA_NAME_VAR (partition_to_var (SA.map, dest));
src_mode = TYPE_MODE (TREE_TYPE (src));
- dest_mode = GET_MODE (SA.partition_to_pseudo[dest]);
+ dest_mode = GET_MODE (dest_rtx);
gcc_assert (src_mode == TYPE_MODE (TREE_TYPE (var)));
- gcc_assert (!REG_P (SA.partition_to_pseudo[dest])
+ gcc_assert (!REG_P (dest_rtx)
|| dest_mode == promote_decl_mode (var, &unsignedp));
if (src_mode != dest_mode)
@@ -312,15 +313,14 @@ insert_value_copy_on_edge (edge e, int d
}
else if (src_mode == BLKmode)
{
- x = SA.partition_to_pseudo[dest];
+ x = dest_rtx;
store_expr (src, x, 0, false);
}
else
- x = expand_expr (src, SA.partition_to_pseudo[dest],
- dest_mode, EXPAND_NORMAL);
+ x = expand_expr (src, dest_rtx, dest_mode, EXPAND_NORMAL);
- if (x != SA.partition_to_pseudo[dest])
- emit_move_insn (SA.partition_to_pseudo[dest], x);
+ if (x != dest_rtx)
+ emit_move_insn (dest_rtx, x);
seq = get_insns ();
end_sequence ();
@@ -356,7 +356,7 @@ insert_rtx_to_part_on_edge (edge e, int
mems. Usually we give the source. As we result from SSA names
the left and right size should be the same (and no WITH_SIZE_EXPR
involved), so it doesn't matter. */
- seq = emit_partition_copy (SA.partition_to_pseudo[dest],
+ seq = emit_partition_copy (copy_rtx (SA.partition_to_pseudo[dest]),
src, unsignedsrcp,
partition_to_var (SA.map, dest));
@@ -390,7 +390,7 @@ insert_part_to_rtx_on_edge (edge e, rtx
var = partition_to_var (SA.map, src);
seq = emit_partition_copy (dest,
- SA.partition_to_pseudo[src],
+ copy_rtx (SA.partition_to_pseudo[src]),
TYPE_UNSIGNED (TREE_TYPE (var)),
var);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PR61919: Invalid rtx sharing in tree-outof-ssa.c
2014-07-27 18:02 PR61919: Invalid rtx sharing in tree-outof-ssa.c Richard Sandiford
@ 2014-07-28 8:03 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2014-07-28 8:03 UTC (permalink / raw)
To: GCC Patches, Richard Sandiford
On Sun, Jul 27, 2014 at 8:01 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> PR 61919 is another ripple from the patch to take advantage of rtx
> sharing rules when instantiating virtual registers. In this case
> the invalid sharing is coming from tree-outof-ssa.c, where the same
> MEM rtx is being used in several moves. (Note that despite the name,
> partition_to_pseudo maps to stack slot MEMs as well as pseudos.)
>
> Tested on x86_64-linux-gnu. Also tested by Andreas on ia64,
> where the testsuite regression showed up. OK to install?
Ok.
Thanks,
Richard.
> Thanks,
> Richard
>
>
> gcc/
> PR middle-end/61919
> * tree-outof-ssa.c (insert_partition_copy_on_edge)
> (insert_value_copy_on_edge, insert_rtx_to_part_on_edge)
> (insert_part_to_rtx_on_edge): Copy partition_to_pseudo rtxes before
> inserting them in the insn stream.
>
> Index: gcc/tree-outof-ssa.c
> ===================================================================
> --- gcc/tree-outof-ssa.c 2014-07-26 21:14:51.074755469 +0100
> +++ gcc/tree-outof-ssa.c 2014-07-26 21:14:51.590759910 +0100
> @@ -260,8 +260,8 @@ insert_partition_copy_on_edge (edge e, i
> set_curr_insn_location (locus);
>
> var = partition_to_var (SA.map, src);
> - seq = emit_partition_copy (SA.partition_to_pseudo[dest],
> - SA.partition_to_pseudo[src],
> + seq = emit_partition_copy (copy_rtx (SA.partition_to_pseudo[dest]),
> + copy_rtx (SA.partition_to_pseudo[src]),
> TYPE_UNSIGNED (TREE_TYPE (var)),
> var);
>
> @@ -274,7 +274,7 @@ insert_partition_copy_on_edge (edge e, i
> static void
> insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
> {
> - rtx seq, x;
> + rtx dest_rtx, seq, x;
> enum machine_mode dest_mode, src_mode;
> int unsignedp;
> tree var;
> @@ -289,7 +289,8 @@ insert_value_copy_on_edge (edge e, int d
> fprintf (dump_file, "\n");
> }
>
> - gcc_assert (SA.partition_to_pseudo[dest]);
> + dest_rtx = copy_rtx (SA.partition_to_pseudo[dest]);
> + gcc_assert (dest_rtx);
>
> set_location_for_edge (e);
> /* If a locus is provided, override the default. */
> @@ -300,9 +301,9 @@ insert_value_copy_on_edge (edge e, int d
>
> var = SSA_NAME_VAR (partition_to_var (SA.map, dest));
> src_mode = TYPE_MODE (TREE_TYPE (src));
> - dest_mode = GET_MODE (SA.partition_to_pseudo[dest]);
> + dest_mode = GET_MODE (dest_rtx);
> gcc_assert (src_mode == TYPE_MODE (TREE_TYPE (var)));
> - gcc_assert (!REG_P (SA.partition_to_pseudo[dest])
> + gcc_assert (!REG_P (dest_rtx)
> || dest_mode == promote_decl_mode (var, &unsignedp));
>
> if (src_mode != dest_mode)
> @@ -312,15 +313,14 @@ insert_value_copy_on_edge (edge e, int d
> }
> else if (src_mode == BLKmode)
> {
> - x = SA.partition_to_pseudo[dest];
> + x = dest_rtx;
> store_expr (src, x, 0, false);
> }
> else
> - x = expand_expr (src, SA.partition_to_pseudo[dest],
> - dest_mode, EXPAND_NORMAL);
> + x = expand_expr (src, dest_rtx, dest_mode, EXPAND_NORMAL);
>
> - if (x != SA.partition_to_pseudo[dest])
> - emit_move_insn (SA.partition_to_pseudo[dest], x);
> + if (x != dest_rtx)
> + emit_move_insn (dest_rtx, x);
> seq = get_insns ();
> end_sequence ();
>
> @@ -356,7 +356,7 @@ insert_rtx_to_part_on_edge (edge e, int
> mems. Usually we give the source. As we result from SSA names
> the left and right size should be the same (and no WITH_SIZE_EXPR
> involved), so it doesn't matter. */
> - seq = emit_partition_copy (SA.partition_to_pseudo[dest],
> + seq = emit_partition_copy (copy_rtx (SA.partition_to_pseudo[dest]),
> src, unsignedsrcp,
> partition_to_var (SA.map, dest));
>
> @@ -390,7 +390,7 @@ insert_part_to_rtx_on_edge (edge e, rtx
>
> var = partition_to_var (SA.map, src);
> seq = emit_partition_copy (dest,
> - SA.partition_to_pseudo[src],
> + copy_rtx (SA.partition_to_pseudo[src]),
> TYPE_UNSIGNED (TREE_TYPE (var)),
> var);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-28 8:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-27 18:02 PR61919: Invalid rtx sharing in tree-outof-ssa.c Richard Sandiford
2014-07-28 8:03 ` Richard Biener
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).