diff options
author | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-16 16:20:12 +0000 |
---|---|---|
committer | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-16 16:20:12 +0000 |
commit | 7c66a2d88e43a1200f01cfc047bb6f30afd19145 (patch) | |
tree | 603a984e5a480221db03c600f853bdf7fde01ef4 /gcc/tree-ssa-pre.c | |
parent | 5745a02ae9e412261d6727cafa32fe05fce93b7c (diff) | |
download | gcc-7c66a2d88e43a1200f01cfc047bb6f30afd19145.tar.gz |
2005-03-16 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/20940
* tree-ssa-pre.c (create_expression_by_pieces): Use
force_gimple_operand on result of fold.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96560 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index e179f0ce792..161d7e5a12c 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -1317,16 +1317,25 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts) case tcc_binary: { tree_stmt_iterator tsi; + tree forced_stmts; tree genop1, genop2; tree temp; + tree folded; tree op1 = TREE_OPERAND (expr, 0); tree op2 = TREE_OPERAND (expr, 1); genop1 = find_or_generate_expression (block, op1, stmts); genop2 = find_or_generate_expression (block, op2, stmts); temp = create_tmp_var (TREE_TYPE (expr), "pretmp"); add_referenced_tmp_var (temp); - newexpr = fold (build (TREE_CODE (expr), TREE_TYPE (expr), - genop1, genop2)); + + folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr), + genop1, genop2)); + newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL); + if (forced_stmts) + { + tsi = tsi_last (stmts); + tsi_link_after (&tsi, forced_stmts, TSI_CONTINUE_LINKING); + } newexpr = build (MODIFY_EXPR, TREE_TYPE (expr), temp, newexpr); NECESSARY (newexpr) = 0; @@ -1341,14 +1350,22 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts) case tcc_unary: { tree_stmt_iterator tsi; + tree forced_stmts; tree genop1; tree temp; + tree folded; tree op1 = TREE_OPERAND (expr, 0); genop1 = find_or_generate_expression (block, op1, stmts); temp = create_tmp_var (TREE_TYPE (expr), "pretmp"); add_referenced_tmp_var (temp); - newexpr = fold (build (TREE_CODE (expr), TREE_TYPE (expr), - genop1)); + folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr), + genop1)); + newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL); + if (forced_stmts) + { + tsi = tsi_last (stmts); + tsi_link_after (&tsi, forced_stmts, TSI_CONTINUE_LINKING); + } newexpr = build (MODIFY_EXPR, TREE_TYPE (expr), temp, newexpr); name = make_ssa_name (temp, newexpr); |