[committed][lto merge]: Various minor fixes
Diego Novillo
dnovillo@google.com
Fri Apr 17 21:44:00 GMT 2009
This patch contains a bunch of minor obvious fixes that we found
in the lto branch.
- Fixing DECL_CONTEXT for new generated temporaries ins omp-low.c
and cgraphunit.c
- Some code factoring used by LTO (find_referenced_vars_in).
- Change a segmentation fault into an assertion in
create_expression_by_pieces. This simplified debugging of an
LTO problem.
- Dependency fixes for Makefile.in
- Fix an ODR violation in builtins/strlen-3.c. Variable
inside_main was declared with incompatible types in two
different files. This only shows up on LTO compiles, of
course.
Bootstrapped and tested on x86_64. Applied to mainline.
Diego.
* omp-low.c (create_omp_child_function): Set DECL_CONTEXT
for DECL.
* cgraphunit.c (cgraph_build_static_cdtor): Likewise.
* tree-dfa.c (find_referenced_vars_in): Factor out of ...
(find_vars_r): ... here.
* tree-flow.h (find_referenced_vars_in): Declare.
* tree-ssa-pre.c (create_expression_by_pieces): Assert
that AVAIL_OUT exists for BLOCK.
* Makefile.in (CGRAPH_H): Add dependency on cif-code.def
(tree-loop-distribution.o): Fix dependency on TREE_VECTORIZER_H.
(tree-parloops.o): Likewise.
testsuite/ChangeLog
* gcc.c-torture/execute/builtins/strlen-3.c: Fix ODR
violation for variable 'inside_main'.
Index: omp-low.c
===================================================================
--- omp-low.c (revision 146277)
+++ omp-low.c (working copy)
@@ -1577,6 +1577,7 @@ create_omp_child_function (omp_context *
t = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
DECL_ARTIFICIAL (t) = 1;
DECL_IGNORED_P (t) = 1;
+ DECL_CONTEXT (t) = decl;
DECL_RESULT (decl) = t;
t = build_decl (PARM_DECL, get_identifier (".omp_data_i"), ptr_type_node);
Index: cgraphunit.c
===================================================================
--- cgraphunit.c (revision 146277)
+++ cgraphunit.c (working copy)
@@ -1369,6 +1369,7 @@ cgraph_build_static_cdtor (char which, t
resdecl = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
DECL_ARTIFICIAL (resdecl) = 1;
DECL_RESULT (decl) = resdecl;
+ DECL_CONTEXT (resdecl) = decl;
allocate_struct_function (decl, false);
Index: testsuite/gcc.c-torture/execute/builtins/strlen-3.c
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/strlen-3.c (revision 146277)
+++ testsuite/gcc.c-torture/execute/builtins/strlen-3.c (working copy)
@@ -10,7 +10,7 @@ extern char *strcpy (char *, const char
static const char bar[] = "Hello, World!";
static const char baz[] = "hello, world?";
static const char larger[20] = "short string";
-extern volatile int inside_main;
+extern int inside_main;
int l1 = 1;
int x = 6;
Index: tree-dfa.c
===================================================================
--- tree-dfa.c (revision 146277)
+++ tree-dfa.c (working copy)
@@ -88,26 +88,10 @@ find_referenced_vars (void)
FOR_EACH_BB (bb)
{
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
- {
- size_t i;
- gimple stmt = gsi_stmt (si);
- for (i = 0; i < gimple_num_ops (stmt); i++)
- walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL);
- }
+ find_referenced_vars_in (gsi_stmt (si));
for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
- {
- gimple phi = gsi_stmt (si);
- size_t i, len = gimple_phi_num_args (phi);
-
- walk_tree (gimple_phi_result_ptr (phi), find_vars_r, NULL, NULL);
-
- for (i = 0; i < len; i++)
- {
- tree arg = gimple_phi_arg_def (phi, i);
- walk_tree (&arg, find_vars_r, NULL, NULL);
- }
- }
+ find_referenced_vars_in (gsi_stmt (si));
}
return 0;
@@ -498,6 +482,33 @@ find_vars_r (tree *tp, int *walk_subtree
return NULL_TREE;
}
+/* Find referenced variables in STMT. In contrast with
+ find_new_referenced_vars, this function will not mark newly found
+ variables for renaming. */
+
+void
+find_referenced_vars_in (gimple stmt)
+{
+ size_t i;
+
+ if (gimple_code (stmt) != GIMPLE_PHI)
+ {
+ for (i = 0; i < gimple_num_ops (stmt); i++)
+ walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL);
+ }
+ else
+ {
+ walk_tree (gimple_phi_result_ptr (stmt), find_vars_r, NULL, NULL);
+
+ for (i = 0; i < gimple_phi_num_args (stmt); i++)
+ {
+ tree arg = gimple_phi_arg_def (stmt, i);
+ walk_tree (&arg, find_vars_r, NULL, NULL);
+ }
+ }
+}
+
+
/* Lookup UID in the referenced_vars hashtable and return the associated
variable. */
Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c (revision 146277)
+++ tree-ssa-pre.c (working copy)
@@ -3003,6 +3003,7 @@ create_expression_by_pieces (basic_block
add_to_value (VN_INFO (forcedname)->value_id, nameexpr);
if (!in_fre)
bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
+ gcc_assert (AVAIL_OUT (block));
bitmap_value_replace_in_set (AVAIL_OUT (block), nameexpr);
}
mark_symbols_for_renaming (stmt);
Index: tree-flow.h
===================================================================
--- tree-flow.h (revision 146277)
+++ tree-flow.h (working copy)
@@ -616,6 +616,7 @@ extern tree gimple_default_def (struct f
extern bool stmt_references_abnormal_ssa_name (gimple);
extern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *,
HOST_WIDE_INT *, HOST_WIDE_INT *);
+extern void find_referenced_vars_in (gimple);
/* In tree-phinodes.c */
extern void reserve_phi_args_for_new_edge (basic_block);
Index: Makefile.in
===================================================================
--- Makefile.in (revision 146277)
+++ Makefile.in (working copy)
@@ -829,7 +829,7 @@ CFGLOOP_H = cfgloop.h $(BASIC_BLOCK_H) $
IPA_UTILS_H = ipa-utils.h $(TREE_H) $(CGRAPH_H)
IPA_REFERENCE_H = ipa-reference.h $(BITMAP_H) $(TREE_H)
IPA_TYPE_ESCAPE_H = ipa-type-escape.h $(TREE_H)
-CGRAPH_H = cgraph.h $(TREE_H) $(BASIC_BLOCK_H)
+CGRAPH_H = cgraph.h $(TREE_H) $(BASIC_BLOCK_H) cif-code.def
DF_H = df.h $(BITMAP_H) $(BASIC_BLOCK_H) alloc-pool.h $(TIMEVAR_H)
RESOURCE_H = resource.h hard-reg-set.h $(DF_H)
DDG_H = ddg.h sbitmap.h $(DF_H)
@@ -2396,11 +2396,11 @@ tree-loop-distribution.o: tree-loop-dist
$(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
$(TREE_PASS_H) $(TREE_DATA_REF_H) $(SCEV_H) $(EXPR_H) \
- $(TARGET_H) tree-chrec.h langhooks.h tree-vectorizer.h
+ $(TARGET_H) tree-chrec.h langhooks.h $(TREE_VECTORIZER_H)
tree-parloops.o: tree-parloops.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_FLOW_H) $(TREE_H) $(RTL_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(GGC_H) \
$(DIAGNOSTIC_H) $(TREE_PASS_H) $(SCEV_H) langhooks.h gt-tree-parloops.h \
- tree-vectorizer.h
+ $(TREE_VECTORIZER_H)
tree-stdarg.o: tree-stdarg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FUNCTION_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
tree-stdarg.h $(TARGET_H) langhooks.h
More information about the Gcc-patches
mailing list