From 3d45dd59c7fcad07ddec7a45d91eb3b7d31897a8 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 14 Mar 2008 14:52:07 +0000 Subject: re PR tree-optimization/34043 (Missed optimization causing extra loads and stores when using x86_64 builtin function together with aggregate types.) 2008-03-14 Richard Guenther PR tree-optimization/34043 PR tree-optimization/33989 * tree-ssa-pre.c (execute_pre): Allow SCCVN to do insertion when doing FRE. (bitmap_find_leader): Use extra argument to verify dominance relationship inside a basic-block. (can_PRE_operation): Add VIEW_CONVERT_EXPR. (find_leader_in_sets): Adjust. (create_component_ref_by_pieces): Take extra argument for dominance check, handle lookup failures. (find_or_generate_expression): Likewise. (create_expression_by_pieces): Likewise. (insert_into_preds_of_block): Adjust. (create_value_expr_from): If asked for, verify all operands are in the blocks AVAIL_OUT set. (make_values_for_stmt): Check for SSA_NAMEs that are life over an abnormal edge. (compute_avail): Remove such check. (do_SCCVN_insertion): New function. (eliminate): If we do not find a leader suitable for replacement insert a replacement expression from SCCVN if available. * tree-ssa-sccvn.h (run_scc_vn): Update prototype. (struct vn_ssa_aux): Add needs_insertion flag. * tree-ssa-sccvn.c (may_insert): New global flag. (copy_reference_ops_from_ref): Value-number union member access based on its size, not type and member if insertion is allowed. (visit_reference_op_load): For a weak match from union type punning lookup a view-converted value and insert a SSA_NAME for that value if that is not found. (visit_use): Make dumps shorter. Do not disallow value numbering SSA_NAMEs that are life over an abnormal edge to constants. (free_scc_vn): Release inserted SSA_NAMEs. (run_scc_vn): New flag to specify whether insertion is allowed. Process SSA_NAMEs in forward order. * tree-ssa-loop-im.c (for_each_index): Handle invariant ADDR_EXPRs inside VIEW_CONVERT_EXPR. * fold-const.c (fold_unary): Fold VIEW_CONVERT_EXPRs from/to pointer type to/from integral types that do not change the precision to regular conversions. * gcc.dg/tree-ssa/ssa-fre-7.c: New testcase. * gcc.dg/tree-ssa/ssa-fre-8.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-9.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-10.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-17.c: Likewise. From-SVN: r133218 --- gcc/tree-ssa-sccvn.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-sccvn.h') diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h index 54055d4..55d9831 100644 --- a/gcc/tree-ssa-sccvn.h +++ b/gcc/tree-ssa-sccvn.h @@ -44,12 +44,17 @@ typedef struct vn_ssa_aux once. It cannot be used to avoid visitation for SSA_NAME's involved in non-singleton SCC's. */ unsigned use_processed : 1; + + /* Whether the SSA_NAME has no defining statement and thus an + insertion of such with EXPR as definition is required before + a use can be created of it. */ + unsigned needs_insertion : 1; } *vn_ssa_aux_t; /* Return the value numbering info for an SSA_NAME. */ extern vn_ssa_aux_t VN_INFO (tree); extern vn_ssa_aux_t VN_INFO_GET (tree); -bool run_scc_vn (void); +bool run_scc_vn (bool); void free_scc_vn (void); void switch_to_PRE_table (void); tree vn_nary_op_lookup (tree); -- cgit v1.1