tree-out-of-ssa.c (insert_value_copy_on_edge): If the source and destination have different modes...

gcc/
	* tree-out-of-ssa.c (insert_value_copy_on_edge): If the source
	and destination have different modes, Use promote_mode to
	determine the signedness of the conversion.  Assert that the
	promoted source mode matches the destination mode.  Don't pass
	the destination and destination mode to expand_expr if the source
	mode is different.  Simplify conversion logic.

From-SVN: r150592
This commit is contained in:
Richard Sandiford 2009-08-09 15:56:27 +00:00 committed by Richard Sandiford
parent 6f4454fcab
commit 8f048d2f21
2 changed files with 27 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2009-08-09 Richard Sandiford <rdsandiford@googlemail.com>
* tree-out-of-ssa.c (insert_value_copy_on_edge): If the source
and destination have different modes, Use promote_mode to
determine the signedness of the conversion. Assert that the
promoted source mode matches the destination mode. Don't pass
the destination and destination mode to expand_expr if the source
mode is different. Simplify conversion logic.
2009-08-09 Ira Rosen <irar@il.ibm.com> 2009-08-09 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/41008 PR tree-optimization/41008

View File

@ -195,7 +195,9 @@ static void
insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus) insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
{ {
rtx seq, x; rtx seq, x;
enum machine_mode mode; enum machine_mode dest_mode, src_mode;
int unsignedp;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
fprintf (dump_file, fprintf (dump_file,
@ -214,14 +216,21 @@ insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
set_curr_insn_source_location (locus); set_curr_insn_source_location (locus);
start_sequence (); start_sequence ();
mode = GET_MODE (SA.partition_to_pseudo[dest]);
x = expand_expr (src, SA.partition_to_pseudo[dest], mode, EXPAND_NORMAL); src_mode = TYPE_MODE (TREE_TYPE (src));
if (GET_MODE (x) != VOIDmode && GET_MODE (x) != mode) unsignedp = TYPE_UNSIGNED (TREE_TYPE (src));
x = convert_to_mode (mode, x, TYPE_UNSIGNED (TREE_TYPE (src))); dest_mode = promote_mode (TREE_TYPE (src), src_mode, &unsignedp);
if (CONSTANT_P (x) && GET_MODE (x) == VOIDmode gcc_assert (dest_mode == GET_MODE (SA.partition_to_pseudo[dest]));
&& mode != TYPE_MODE (TREE_TYPE (src)))
x = convert_modes (mode, TYPE_MODE (TREE_TYPE (src)), if (src_mode != dest_mode)
x, TYPE_UNSIGNED (TREE_TYPE (src))); {
x = expand_expr (src, NULL, src_mode, EXPAND_NORMAL);
x = convert_modes (dest_mode, src_mode, x, unsignedp);
}
else
x = expand_expr (src, SA.partition_to_pseudo[dest],
dest_mode, EXPAND_NORMAL);
if (x != SA.partition_to_pseudo[dest]) if (x != SA.partition_to_pseudo[dest])
emit_move_insn (SA.partition_to_pseudo[dest], x); emit_move_insn (SA.partition_to_pseudo[dest], x);
seq = get_insns (); seq = get_insns ();