summaryrefslogtreecommitdiff
path: root/gcc/tree-outof-ssa.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-09 15:56:27 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-09 15:56:27 +0000
commite81447c7adc2b9a581985b9c0544821357f628cf (patch)
treed0f4701d42c84b19ff0c5a464284103a2fec956b /gcc/tree-outof-ssa.c
parenta18d432721f3762fca7dc8b98c7b497adea649e2 (diff)
downloadgcc-e81447c7adc2b9a581985b9c0544821357f628cf.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150592 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-outof-ssa.c')
-rw-r--r--gcc/tree-outof-ssa.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 420ee8099b4..c0826e70423 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -195,7 +195,9 @@ static void
insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
{
rtx seq, x;
- enum machine_mode mode;
+ enum machine_mode dest_mode, src_mode;
+ int unsignedp;
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
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);
start_sequence ();
- mode = GET_MODE (SA.partition_to_pseudo[dest]);
- 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)));
+
+ src_mode = TYPE_MODE (TREE_TYPE (src));
+ unsignedp = TYPE_UNSIGNED (TREE_TYPE (src));
+ dest_mode = promote_mode (TREE_TYPE (src), src_mode, &unsignedp);
+ gcc_assert (dest_mode == GET_MODE (SA.partition_to_pseudo[dest]));
+
+ if (src_mode != dest_mode)
+ {
+ 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])
emit_move_insn (SA.partition_to_pseudo[dest], x);
seq = get_insns ();