From 0045e505634d3f126b624ca3c89664f380f128bf Mon Sep 17 00:00:00 2001 From: rguenth Date: Sat, 1 Mar 2008 00:27:26 +0000 Subject: [PATCH] 2008-03-01 Richard Guenther PR tree-optimization/35411 * tree-sra.c (sra_build_assignment): Split conversion to final type to a separate statement if we are not assigning to a register. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132791 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/tree-sra.c | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6f51da..2944d20 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-03-01 Richard Guenther + + PR tree-optimization/35411 + * tree-sra.c (sra_build_assignment): Split conversion to + final type to a separate statement if we are not assigning + to a register. + 2008-02-29 Francois-Xavier Coudert * fold-const.c (fold_convertible_p): Correct the logic to follow diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 26f1af4..1f2d6c2 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2139,7 +2139,7 @@ sra_build_assignment (tree dst, tree src) if (scalar_bitfield_p (src)) { tree var, shift, width; - tree utype, stype, stmp, utmp; + tree utype, stype, stmp, utmp, dtmp; tree list, stmt; bool unsignedp = BIT_FIELD_REF_UNSIGNED (src); @@ -2256,6 +2256,16 @@ sra_build_assignment (tree dst, tree src) var = fold_convert (TREE_TYPE (dst), var); else var = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (dst), var); + + /* If the destination is not a register the conversion needs + to be a separate statement. */ + if (!is_gimple_reg (dst)) + { + dtmp = make_rename_temp (TREE_TYPE (dst), "SR"); + stmt = build_gimple_modify_stmt (dtmp, var); + append_to_statement_list (stmt, &list); + var = dtmp; + } } stmt = build_gimple_modify_stmt (dst, var); append_to_statement_list (stmt, &list); -- 2.7.4