From 6999afe1b9fd5fe6babd4139b34ed9bbaacaeebb Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Thu, 10 Jul 2008 17:00:37 +0000 Subject: [PATCH] tree-ssa-pre.c (create_expression_by_pieces): Add fold_convert calls. 2008-07-10 Daniel Berlin * tree-ssa-pre.c (create_expression_by_pieces): Add fold_convert calls. (eliminate): Ditto. (execute_pre): Call loop_optimizer_finalize in early exit. From-SVN: r137696 --- gcc/ChangeLog | 7 +++++++ gcc/tree-ssa-pre.c | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96e6b134c66..860ef8ba286 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-07-10 Daniel Berlin + + * tree-ssa-pre.c (create_expression_by_pieces): Add fold_convert + calls. + (eliminate): Ditto. + (execute_pre): Call loop_optimizer_finalize in early exit. + 2008-07-10 Jakub Jelinek PR middle-end/36790 diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 53c3957bf03..ecaf54c942d 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2448,10 +2448,10 @@ create_component_ref_by_pieces (basic_block block, vn_reference_t ref, if (!genop1) return NULL_TREE; genop1 = fold_convert (build_pointer_type (currop->type), - genop1); + genop1); folded = fold_build1 (currop->opcode, currop->type, - genop1); + genop1); return folded; } } @@ -2694,10 +2694,15 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts, stmts, domstmt); if (!genop1 || !genop2) return NULL_TREE; + genop1 = fold_convert (TREE_TYPE (nary->op[0]), + genop1); /* Ensure op2 is a sizetype for POINTER_PLUS_EXPR. It may be a constant with the wrong type. */ if (nary->opcode == POINTER_PLUS_EXPR) genop2 = fold_convert (sizetype, genop2); + else + genop2 = fold_convert (TREE_TYPE (nary->op[0]), genop2); + folded = fold_build2 (nary->opcode, nary->type, genop1, genop2); } @@ -2709,6 +2714,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr, tree stmts, stmts, domstmt); if (!genop1) return NULL_TREE; + genop1 = fold_convert (TREE_TYPE (nary->op[0]), genop1); + folded = fold_build1 (nary->opcode, nary->type, genop1); } @@ -3818,11 +3825,13 @@ eliminate (void) else gcc_unreachable (); } + /* If there is no existing leader but SCCVN knows this value is constant, use that constant. */ if (!sprime && is_gimple_min_invariant (VN_INFO (lhs)->valnum)) { - sprime = VN_INFO (lhs)->valnum; + sprime = fold_convert (TREE_TYPE (lhs), + VN_INFO (lhs)->valnum); if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -4171,7 +4180,11 @@ execute_pre (bool do_fre) if (!run_scc_vn (do_fre)) { if (!do_fre) - remove_dead_inserted_code (); + { + remove_dead_inserted_code (); + loop_optimizer_finalize (); + } + return 0; } init_pre (do_fre); -- 2.30.2