On Thu, Oct 9, 2014 at 11:14 AM, Zhenqiang Chen <zhenqiang.c...@arm.com> wrote: > Hi, > > The are two implementations of seq_cost. The function bodies are exactly the > same. The patch removes one of them and make the other global. > > Bootstrap and no make check regression on X86-64. > > OK for trunk?
The prototype should go to cfgloopanal.c. Thanks, RIchard. > Thanks! > -Zhenqiang > > ChangeLog: > 2014-10-09 Zhenqiang Chen <zhenqiang.c...@arm.com> > > * cfgloopanal.c (seq_cost): Make it global. > * rtl.h (seq_cost): New prototype. > * tree-ssa-loop-ivopts.c (seq_cost): Delete. > > diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c > index 7ea1a5f..dd37aa0 100644 > --- a/gcc/cfgloopanal.c > +++ b/gcc/cfgloopanal.c > @@ -304,7 +304,7 @@ get_loop_level (const struct loop *loop) > > /* Returns estimate on cost of computing SEQ. */ > > -static unsigned > +unsigned > seq_cost (const rtx_insn *seq, bool speed) > { > unsigned cost = 0; > diff --git a/gcc/rtl.h b/gcc/rtl.h > index e73f731..b697417 100644 > --- a/gcc/rtl.h > +++ b/gcc/rtl.h > @@ -2921,6 +2921,7 @@ extern rtx_insn *find_first_parameter_load (rtx_insn > *, rtx_insn *); > extern bool keep_with_call_p (const rtx_insn *); > extern bool label_is_jump_target_p (const_rtx, const rtx_insn *); > extern int insn_rtx_cost (rtx, bool); > +extern unsigned seq_cost (const rtx_insn *, bool); > > /* Given an insn and condition, return a canonical description of > the test being made. */ > diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c > index 400798a..087ca26 100644 > --- a/gcc/tree-ssa-loop-ivopts.c > +++ b/gcc/tree-ssa-loop-ivopts.c > @@ -2842,26 +2842,6 @@ get_use_iv_cost (struct ivopts_data *data, struct > iv_use *use, > return NULL; > } > > -/* Returns estimate on cost of computing SEQ. */ > - > -static unsigned > -seq_cost (rtx_insn *seq, bool speed) > -{ > - unsigned cost = 0; > - rtx set; > - > - for (; seq; seq = NEXT_INSN (seq)) > - { > - set = single_set (seq); > - if (set) > - cost += set_src_cost (SET_SRC (set), speed); > - else > - cost++; > - } > - > - return cost; > -} > - > /* Produce DECL_RTL for object obj so it looks like it is stored in memory. > */ > static rtx > produce_memory_decl_rtl (tree obj, int *regno) > > >