+2007-08-14 Daniel Berlin <dberlin@dberlin.org>
+
+ * tree-pass.h (PROP_pta): Removed.
+ (TODO_rebuild_alias): New.
+ (pass_may_alias): Removed.
+ * tree-ssa-ccp.c (execute_fold_all_builtins): Only rebuild
+ aliasing if we changed something.
+ * tree-ssa-alias.c (compute_may_aliases): Make non-static. Update
+ SSA internally.
+ (pass_may_alias): Removed.
+ (create_structure_vars): Return TODO_rebuild_alias.
+ * tree-ssa-pre.c (do_pre): Return TODO_rebuild_alias.
+ * tree-sra.c (tree_sra): Only rebuild aliasing if something
+ changed.
+ (tree_sra_early): We never affect aliasing right now.
+ * tree-flow.h (compute_may_aliases): New prototype.
+ * passes.c: Remove pass_may_alias from the passes.
+ (execute_function_todo): Support TODO_rebuild_alias.
+
2007-08-14 Kai Tietz <kai.tietz@onevision.com>
* i386.c: (legitimize_address): Move dllimported variable check
* emit-rtl.c (try_split): Relink the insns with REG_LIBCALL note
and with REG_RETVAL note after split.
+>>>>>>> .r127481
2007-08-11 David Daney <ddaney@avtrex.com>
* config/mips/mips.c (mips_sched_reorder): Mark cycle parameter
{
struct tree_opt_pass **p = &pass_all_optimizations.sub;
NEXT_PASS (pass_create_structure_vars);
- NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_return_slot);
NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_vrp);
NEXT_PASS (pass_dce);
NEXT_PASS (pass_dominator);
-
/* The only const/copy propagation opportunities left after
DOM should be due to degenerate PHI nodes. So rather than
run the full propagators, run a specialized pass which
only examines PHIs to discover const/copy propagation
opportunities. */
NEXT_PASS (pass_phi_only_cprop);
-
NEXT_PASS (pass_tree_ifcombine);
NEXT_PASS (pass_phiopt);
- NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_tail_recursion);
NEXT_PASS (pass_ch);
NEXT_PASS (pass_stdarg);
NEXT_PASS (pass_lower_complex);
NEXT_PASS (pass_sra);
- /* FIXME: SRA may generate arbitrary gimple code, exposing new
- aliased and call-clobbered variables. As mentioned below,
- pass_may_alias should be a TODO item. */
- NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_dominator);
NEXT_PASS (pass_reassoc);
NEXT_PASS (pass_dce);
NEXT_PASS (pass_dse);
- NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_object_sizes);
NEXT_PASS (pass_store_copy_prop);
NEXT_PASS (pass_fold_builtins);
NEXT_PASS (pass_cse_sincos);
- /* FIXME: May alias should a TODO but for 4.0.0,
- we add may_alias right after fold builtins
- which can create arbitrary GIMPLE. */
- NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_pre);
- NEXT_PASS (pass_may_alias);
NEXT_PASS (pass_sink_code);
NEXT_PASS (pass_tree_loop);
{
NEXT_PASS (pass_lower_vector_ssa);
NEXT_PASS (pass_dce_loop);
}
- /* NEXT_PASS (pass_may_alias) cannot be done again because the
- vectorizer creates alias relations that are not supported by
- pass_may_alias. */
NEXT_PASS (pass_complete_unroll);
NEXT_PASS (pass_loop_prefetch);
NEXT_PASS (pass_iv_optimize);
NEXT_PASS (pass_reassoc);
NEXT_PASS (pass_vrp);
NEXT_PASS (pass_dominator);
-
+
/* The only const/copy propagation opportunities left after
DOM should be due to degenerate PHI nodes. So rather than
run the full propagators, run a specialized pass which
update_ssa (update_flags);
cfun->last_verified &= ~TODO_verify_ssa;
}
-
+
+ if (flags & TODO_rebuild_alias)
+ {
+ compute_may_aliases ();
+ cfun->curr_properties |= PROP_alias;
+ }
+
if (flags & TODO_remove_unused_locals)
remove_unused_locals ();
/* With tree-ssa, gcc.dg/20000724-1.c failed because we missed
a VOP of x in the asm statement. */
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-alias1-vops" } */
+/* { dg-options "-O1 -fdump-tree-salias-vops" } */
struct s { int a; };
}
/* The VDEF comes from the initial assignment and the asm. */
-/* { dg-final { scan-tree-dump-times "DEF" 2 "alias1" } } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
+/* { dg-final { scan-tree-dump-times "DEF" 2 "salias" } } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-alias1-vops" } */
+/* { dg-options "-O1 -fdump-tree-salias-vops" } */
extern void abort (void);
int a;
malloc functions may clobber global memory. Only the function result
does not alias any other pointer.
Hence, we must have a VDEF for a before and after the call to foo(). */
-/* { dg-final { scan-tree-dump-times "VDEF" 2 "alias1"} } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
+/* { dg-final { scan-tree-dump-times "VDEF" 2 "salias"} } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
/* Verify that points-to information is handled properly for PTR + OFFSET
pointer arithmetics. */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-alias1-vops" } */
+/* { dg-options "-O2 -fdump-tree-salias-vops" } */
char buf[4], *q;
int foo (int i)
return *p;
}
-/* { dg-final { scan-tree-dump-not "VUSE <c" "alias1" } } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
+/* { dg-final { scan-tree-dump-not "VUSE <c" "salias" } } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-alias1-vops" } */
+/* { dg-options "-O2 -fdump-tree-salias-vops" } */
struct {
int i;
return a.x[i];
}
-/* { dg-final { scan-tree-dump "VDEF" "alias1" } } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
+/* { dg-final { scan-tree-dump "VDEF" "salias" } } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-alias1-vops" } */
+/* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-salias-vops" } */
/* Test to make sure that inline-asm causes a V_MAY_DEF and that we call test_function twice. */
char test_function(void ) __attribute__((__pure__));
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* There should a VDEF for the inline-asm. */
-/* { dg-final { scan-tree-dump-times "VDEF" 1 "alias1"} } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
+/* { dg-final { scan-tree-dump-times "VDEF" 1 "salias"} } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-alias1-vops" } */
+/* { dg-options "-O1 -fdump-tree-salias-vops" } */
/* Test to make sure that inline-asm causes a V_MAY_DEF. */
}
/* There should a VDEF for the inline-asm and one for the link_error. */
-/* { dg-final { scan-tree-dump-times "VDEF" 2 "alias1"} } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
+/* { dg-final { scan-tree-dump-times "VDEF" 2 "salias"} } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-alias-vops" } */
+/* { dg-options "-O2 -fdump-tree-salias-vops" } */
struct a
{
int length;
struct a *a = malloc(sizeof(struct a));
return a->length;
}
-/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias1"} } */
-/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias2"} } */
-/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias3"} } */
-/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias4"} } */
-/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias5"} } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
-/* { dg-final { cleanup-tree-dump "alias2" } } */
-/* { dg-final { cleanup-tree-dump "alias3" } } */
-/* { dg-final { cleanup-tree-dump "alias4" } } */
-/* { dg-final { cleanup-tree-dump "alias5" } } */
-/* { dg-final { cleanup-tree-dump "alias6" } } */
+/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "salias"} } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-alias1-vops" } */
+/* { dg-options "-O2 -fdump-tree-salias-vops" } */
typedef struct {
int i;
return a.i;
}
-/* { dg-final { scan-tree-dump-times "VDEF" 2 "alias1" } } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
+/* { dg-final { scan-tree-dump-times "VDEF" 2 "salias" } } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-alias1" } */
+/* { dg-options "-O2 -fdump-tree-salias" } */
extern double cos (double);
extern double sin (double);
double f(double a)
}
/* The points-to set of the final function pointer should be "sin cos" */
-/* { dg-final { scan-tree-dump-times "{ sin cos }" 1 "alias1"} } */
-/* { dg-final { cleanup-tree-dump "alias1" } } */
+/* { dg-final { scan-tree-dump-times "{ sin cos }" 1 "salias"} } */
+/* { dg-final { cleanup-tree-dump "salias" } } */
return a.b.c.j;
}
-/* { dg-final { scan-tree-dump-times "SFT" 2 "salias" } } */
+/* { dg-final { scan-tree-dump-times "structure field tag SFT" 2 "salias" } } */
/* { dg-final { cleanup-tree-dump "salias" } } */
extern bool block_may_fallthru (const_tree);
/* In tree-ssa-alias.c */
+extern unsigned int compute_may_aliases (void);
extern void dump_may_aliases_for (FILE *, tree);
extern void debug_may_aliases_for (tree);
extern void dump_alias_info (FILE *);
#define PROP_gimple_leh (1 << 2) /* lowered eh */
#define PROP_cfg (1 << 3)
#define PROP_referenced_vars (1 << 4)
-#define PROP_pta (1 << 5)
-#define PROP_ssa (1 << 6)
-#define PROP_no_crit_edges (1 << 7)
-#define PROP_rtl (1 << 8)
-#define PROP_alias (1 << 9)
-#define PROP_gimple_lomp (1 << 10) /* lowered OpenMP directives */
+#define PROP_ssa (1 << 5)
+#define PROP_no_crit_edges (1 << 6)
+#define PROP_rtl (1 << 7)
+#define PROP_alias (1 << 8)
+#define PROP_gimple_lomp (1 << 9) /* lowered OpenMP directives */
#define PROP_trees \
(PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
/* Internally used for the first instance of a pass. */
#define TODO_mark_first_instance (1 << 18)
+/* Rebuild aliasing info. */
+#define TODO_rebuild_alias (1 << 19)
+
#define TODO_update_ssa_any \
(TODO_update_ssa \
| TODO_update_ssa_no_phi \
extern struct tree_opt_pass pass_dce_loop;
extern struct tree_opt_pass pass_cd_dce;
extern struct tree_opt_pass pass_merge_phi;
-extern struct tree_opt_pass pass_may_alias;
extern struct tree_opt_pass pass_split_crit_edges;
extern struct tree_opt_pass pass_pre;
extern struct tree_opt_pass pass_profile;
scan_function ();
decide_instantiations ();
scalarize_function ();
+ if (!bitmap_empty_p (sra_candidates))
+ todoflags |= TODO_rebuild_alias;
}
/* Free allocated memory. */
ret = tree_sra ();
early_sra = false;
- return ret;
+ return ret & ~TODO_rebuild_alias;
}
static bool
grouped to avoid severe compile-time slow downs and memory
consumption. See compute_memory_partitions. */
-static unsigned int
+unsigned int
compute_may_aliases (void)
{
struct alias_info *ai;
+
+ timevar_push (TV_TREE_MAY_ALIAS);
memset (&alias_stats, 0, sizeof (alias_stats));
/* Deallocate memory used by aliasing data structures. */
delete_alias_info (ai);
+
+ if (need_ssa_update_p ())
+ update_ssa (TODO_update_ssa);
+
+ timevar_pop (TV_TREE_MAY_ALIAS);
return 0;
}
-
-struct tree_opt_pass pass_may_alias =
-{
- "alias", /* name */
- NULL, /* gate */
- compute_may_aliases, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_TREE_MAY_ALIAS, /* tv_id */
- PROP_cfg | PROP_ssa, /* properties_required */
- PROP_alias, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_dump_func
- | TODO_update_ssa
- | TODO_ggc_collect
- | TODO_verify_ssa
- | TODO_verify_stmts, /* todo_flags_finish */
- 0 /* letter */
-};
-
-
/* Data structure used to count the number of dereferences to PTR
inside an expression. */
struct count_ptr_d
}
}
- return 0;
+ return TODO_rebuild_alias;
}
static bool
{
bool cfg_changed = false;
basic_block bb;
+ unsigned int todoflags = 0;
+
FOR_EACH_BB (bb)
{
block_stmt_iterator i;
{
bool ok = set_rhs (stmtp, result);
gcc_assert (ok);
+ todoflags |= TODO_rebuild_alias;
}
}
bsi_next (&i);
}
}
-
+
/* Delete unreachable blocks. */
- return cfg_changed ? TODO_cleanup_cfg : 0;
+ if (cfg_changed)
+ todoflags |= TODO_cleanup_cfg;
+
+ return todoflags;
}
do_pre (void)
{
execute_pre (false);
- return 0;
+ return TODO_rebuild_alias;
}
static bool