|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[PATCH] Some PTA fixesThis fixes some issues in generic PTA code that I noticed when working on IPA-PTA. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2009-11-07 Richard Guenther <rguenther@...> * tree-ssa-structalias.c (build_succ_graph): Feed stores to anything only to variables that can take pointers. (get_constraint_for_ssa_var): Properly exclude full variables from expanding. (first_vi_for_offset): Avoid overflow in arithmetic. (first_or_preceding_vi_for_offset): Likewise. (count_num_arguments): Fix implementation. (gate_ipa_pta): Do not run when not optimizing. Index: gcc/tree-ssa-structalias.c =================================================================== *** gcc/tree-ssa-structalias.c (revision 153973) --- gcc/tree-ssa-structalias.c (working copy) *************** build_succ_graph (void) *** 1269,1279 **** } } ! /* Add edges from STOREDANYTHING to all non-direct nodes. */ t = find (storedanything_id); for (i = integer_id + 1; i < FIRST_REF_NODE; ++i) { ! if (!TEST_BIT (graph->direct_nodes, i)) add_graph_edge (graph, find (i), t); } } --- 1269,1281 ---- } } ! /* Add edges from STOREDANYTHING to all non-direct nodes that can ! receive pointers. */ t = find (storedanything_id); for (i = integer_id + 1; i < FIRST_REF_NODE; ++i) { ! if (!TEST_BIT (graph->direct_nodes, i) ! && get_varinfo (i)->may_have_pointers) add_graph_edge (graph, find (i), t); } } *************** get_constraint_for_ssa_var (tree t, VEC( *** 2720,2726 **** /* If we are not taking the address of the constraint expr, add all sub-fiels of the variable as well. */ ! if (!address_p) { for (; vi; vi = vi->next) { --- 2722,2729 ---- /* If we are not taking the address of the constraint expr, add all sub-fiels of the variable as well. */ ! if (!address_p ! && !vi->is_full_var) { for (; vi; vi = vi->next) { *************** first_vi_for_offset (varinfo_t start, un *** 4032,4038 **** In that case, however, offset should still be within the size of the variable. */ if (offset >= start->offset ! && offset < (start->offset + start->size)) return start; start= start->next; --- 4035,4041 ---- In that case, however, offset should still be within the size of the variable. */ if (offset >= start->offset ! && (offset - start->offset) < start->size) return start; start= start->next; *************** first_or_preceding_vi_for_offset (varinf *** 4062,4068 **** directly preceding offset which may be the last field. */ while (start->next && offset >= start->offset ! && !(offset < (start->offset + start->size))) start = start->next; return start; --- 4065,4071 ---- directly preceding offset which may be the last field. */ while (start->next && offset >= start->offset ! && !((offset - start->offset) < start->size)) start = start->next; return start; *************** push_fields_onto_fieldstack (tree type, *** 4286,4306 **** static unsigned int count_num_arguments (tree decl, bool *is_varargs) { ! unsigned int i = 0; tree t; ! for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); ! t; ! t = TREE_CHAIN (t)) ! { ! if (TREE_VALUE (t) == void_type_node) ! break; ! i++; ! } ! if (!t) *is_varargs = true; ! return i; } /* Creation function node for DECL, using NAME, and return the index --- 4289,4310 ---- static unsigned int count_num_arguments (tree decl, bool *is_varargs) { ! unsigned int num = 0; tree t; ! /* Capture named arguments for K&R functions. They do not ! have a prototype and thus no TYPE_ARG_TYPES. */ ! for (t = DECL_ARGUMENTS (decl); t; t = TREE_CHAIN (t)) ! ++num; ! ! /* Check if the function has variadic arguments. */ ! for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); t; t = TREE_CHAIN (t)) ! if (TREE_VALUE (t) == void_type_node) ! break; if (!t) *is_varargs = true; ! ! return num; } /* Creation function node for DECL, using NAME, and return the index *************** struct gimple_opt_pass pass_build_ealias *** 5654,5660 **** static bool gate_ipa_pta (void) { ! return (flag_ipa_pta /* Don't bother doing anything if the program has errors. */ && !(errorcount || sorrycount)); } --- 5658,5665 ---- static bool gate_ipa_pta (void) { ! return (optimize ! && flag_ipa_pta /* Don't bother doing anything if the program has errors. */ && !(errorcount || sorrycount)); } |
| Free embeddable forum powered by Nabble | Forum Help |