Submitted By: Ryan Oliver Source: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173 Initial Package Version: 4.0.0 Upstrean Status: In Gcc4 Mainline Description: 2005-04-25 Daniel Berlin Fix PR tree-optimization/21173 * tree-ssa-pre.c (create_expression_by_pieces): Call unshare_expr on things we pass to force_gimple_operand. Don't try to special case min_invariants. =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v retrieving revision 2.65.4.2 retrieving revision 2.65.4.3 diff -u -r2.65.4.2 -r2.65.4.3 --- gcc/gcc/tree-ssa-pre.c 2005/04/17 23:40:31 2.65.4.2 +++ gcc/gcc/tree-ssa-pre.c 2005/04/25 14:02:31 2.65.4.3 @@ -1330,7 +1330,8 @@ folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr), genop1, genop2)); - newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL); + newexpr = force_gimple_operand (unshare_expr (folded), + &forced_stmts, false, NULL); if (forced_stmts) { tsi = tsi_start (forced_stmts); @@ -1372,14 +1373,8 @@ add_referenced_tmp_var (temp); folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr), genop1)); - /* If the generated operand is already GIMPLE min_invariant - just use it instead of calling force_gimple_operand on it, - since that may make it not invariant by copying it into an - assignment. */ - if (!is_gimple_min_invariant (genop1)) - newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL); - else - newexpr = genop1; + newexpr = force_gimple_operand (unshare_expr (folded), + &forced_stmts, false, NULL); if (forced_stmts) { tsi = tsi_start (forced_stmts);