Commit f9453c07 by Bill Schmidt Committed by William Schmidt

tree-pass.h (pass_strength_reduction): New decl.

gcc:

2012-06-26  Bill Schmidt  <wschmidt@linux.ibm.com>

	* tree-pass.h (pass_strength_reduction): New decl.
	* tree-ssa-loop-ivopts.c (initialize_costs): Make non-static.
	(finalize_costs): Likewise.
	* timevar.def (TV_TREE_SLSR): New timevar.
	* gimple-ssa-strength-reduction.c: New.
	* tree-flow.h (initialize_costs): New decl.
	(finalize_costs): Likewise.
	* Makefile.in (tree-ssa-strength-reduction.o): New dependencies.
	* passes.c (init_optimization_passes): Add pass_strength_reduction.

gcc/testsuite:

2012-06-26  Bill Schmidt  <wschmidt@linux.ibm.com>

	* gcc.dg/tree-ssa/slsr-1.c: New test.
	* gcc.dg/tree-ssa/slsr-2.c: Likewise.
	* gcc.dg/tree-ssa/slsr-3.c: Likewise.
	* gcc.dg/tree-ssa/slsr-4.c: Likewise.

From-SVN: r188989
parent 703ae70c
2012-06-26 Bill Schmidt <wschmidt@linux.ibm.com>
* tree-pass.h (pass_strength_reduction): New decl.
* tree-ssa-loop-ivopts.c (initialize_costs): Make non-static.
(finalize_costs): Likewise.
* timevar.def (TV_TREE_SLSR): New timevar.
* gimple-ssa-strength-reduction.c: New.
* tree-flow.h (initialize_costs): New decl.
(finalize_costs): Likewise.
* Makefile.in (tree-ssa-strength-reduction.o): New dependencies.
* passes.c (init_optimization_passes): Add pass_strength_reduction.
2012-06-26 Matt Turner <mattst88@gmail.com>
* doc/extend.texi (__builtin_arm_tinsrb): Add missing second
......
......@@ -1243,6 +1243,7 @@ OBJS = \
gimple-fold.o \
gimple-low.o \
gimple-pretty-print.o \
gimple-ssa-strength-reduction.o \
gimple-streamer-in.o \
gimple-streamer-out.o \
gimplify.o \
......@@ -2432,6 +2433,11 @@ tree-ssa-sccvn.o : tree-ssa-sccvn.c $(TREE_FLOW_H) $(CONFIG_H) \
alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) langhooks.h $(HASHTAB_H) $(GIMPLE_H) \
$(TREE_INLINE_H) tree-iterator.h tree-ssa-propagate.h tree-ssa-sccvn.h \
$(PARAMS_H) $(GIMPLE_PRETTY_PRINT_H) gimple-fold.h
gimple-ssa-strength-reduction.o : gimple-ssa-strength-reduction.c $(CONFIG_H) \
$(SYSTEM_H) coretypes.h $(TREE_H) $(GIMPLE_H) $(BASIC_BLOCK_H) \
$(TREE_PASS_H) $(TIMEVAR_H) $(CFGLOOP_H) $(TREE_PRETTY_PRINT_H) \
$(GIMPLE_PRETTY_PRINT_H) alloc-pool.h $(TREE_FLOW_H) domwalk.h \
pointer-set.h
tree-vrp.o : tree-vrp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(TREE_FLOW_H) $(TREE_PASS_H) $(TREE_DUMP_H) $(DIAGNOSTIC_CORE_H) $(GGC_H) \
$(BASIC_BLOCK_H) tree-ssa-propagate.h $(FLAGS_H) $(TREE_DUMP_H) \
......
......@@ -1463,6 +1463,7 @@ init_optimization_passes (void)
NEXT_PASS (pass_cse_reciprocals);
NEXT_PASS (pass_reassoc);
NEXT_PASS (pass_vrp);
NEXT_PASS (pass_strength_reduction);
NEXT_PASS (pass_dominator);
/* The only const/copy propagation opportunities left after
DOM should be due to degenerate PHI nodes. So rather than
......
2012-06-26 Bill Schmidt <wschmidt@linux.ibm.com>
* gcc.dg/tree-ssa/slsr-1.c: New test.
* gcc.dg/tree-ssa/slsr-2.c: Likewise.
* gcc.dg/tree-ssa/slsr-3.c: Likewise.
* gcc.dg/tree-ssa/slsr-4.c: Likewise.
2012-06-26 Matt Turner <mattst88@gmail.com>
PR target/35294
......
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-optimized" } */
extern void foo (int);
void
f (int *p, unsigned int n)
{
foo (*(p + n * 4));
foo (*(p + 32 + n * 4));
if (n > 3)
foo (*(p + 16 + n * 4));
else
foo (*(p + 48 + n * 4));
}
/* { dg-final { scan-tree-dump-times "\\+ 128" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 64" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 192" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-optimized" } */
extern void foo (int);
void
f (int *p, int n)
{
foo (*(p + n++ * 4));
foo (*(p + 32 + n++ * 4));
foo (*(p + 16 + n * 4));
}
/* { dg-final { scan-tree-dump-times "\\+ 144" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 96" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-optimized" } */
int
foo (int a[], int b[], int i)
{
a[i] = b[i] + 2;
i++;
a[i] = b[i] + 2;
i++;
a[i] = b[i] + 2;
i++;
a[i] = b[i] + 2;
i++;
return i;
}
/* { dg-final { scan-tree-dump-times "\\* 4" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 4" 2 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 8" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 12" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-slsr -fdump-tree-optimized" } */
void foo (int);
int
f (int i)
{
int x, y;
x = i * 4;
y = x * 10;
foo (y);
i = i + 5;
x = i * 4;
y = x * 10;
foo (y);
i = i - 4;
x = i * 4;
y = x * 10;
foo (y);
}
/* { dg-final { scan-tree-dump-times "\\* 4" 1 "slsr" } } */
/* { dg-final { scan-tree-dump-times "\\* 10" 1 "slsr" } } */
/* { dg-final { scan-tree-dump-times "\\+ 20;" 1 "slsr" } } */
/* { dg-final { scan-tree-dump-times "\\+ 200" 1 "slsr" } } */
/* { dg-final { scan-tree-dump-times "\\- 16;" 1 "slsr" } } */
/* { dg-final { scan-tree-dump-times "\\- 160" 1 "slsr" } } */
/* { dg-final { scan-tree-dump-times "\\* 4" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\* 10" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 200" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "\\+ 40" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "slsr" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
......@@ -257,6 +257,7 @@ DEFTIMEVAR (TV_TREE_IFCOMBINE , "tree if-combine")
DEFTIMEVAR (TV_TREE_UNINIT , "uninit var analysis")
DEFTIMEVAR (TV_PLUGIN_INIT , "plugin initialization")
DEFTIMEVAR (TV_PLUGIN_RUN , "plugin execution")
DEFTIMEVAR (TV_GIMPLE_SLSR , "straight-line strength reduction")
/* Everything else in rest_of_compilation not included above. */
DEFTIMEVAR (TV_EARLY_LOCAL , "early local passes")
......
......@@ -810,6 +810,8 @@ bool expr_invariant_in_loop_p (struct loop *, tree);
bool stmt_invariant_in_loop_p (struct loop *, gimple);
bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode,
addr_space_t);
void initialize_costs (void);
void finalize_costs (void);
unsigned multiply_by_const_cost (HOST_WIDE_INT, enum machine_mode, bool);
unsigned add_regs_cost (enum machine_mode, bool);
unsigned multiply_regs_cost (enum machine_mode, bool);
......
......@@ -452,6 +452,7 @@ extern struct gimple_opt_pass pass_tm_memopt;
extern struct gimple_opt_pass pass_tm_edges;
extern struct gimple_opt_pass pass_split_functions;
extern struct gimple_opt_pass pass_feedback_split_functions;
extern struct gimple_opt_pass pass_strength_reduction;
/* IPA Passes */
extern struct simple_ipa_opt_pass pass_ipa_lower_emutls;
......
......@@ -856,7 +856,7 @@ htab_inv_expr_hash (const void *ent)
/* Allocate data structures for the cost model. */
static void
void
initialize_costs (void)
{
mult_costs[0] = htab_create (100, mbc_entry_hash, mbc_entry_eq, free);
......@@ -866,7 +866,7 @@ initialize_costs (void)
/* Release data structures for the cost model. */
static void
void
finalize_costs (void)
{
cost_tables_exist = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment