on 2019/5/14 下午3:24, Richard Biener wrote:> 
> Most of the rs6000 target hook checks look general
> (can we compute niter, etc.), IVOPTs would have a hard
> time adding a counter IV w/o being able to compute niters.

Do you mean to reuse them?

Yes, IVOPTs has already checked niter.  At the initial 
version of this patch, I tried to pass more parameters
for this hook, but IMHO it looks not elegant.  In future,
if this hook is called in other places, it may require
others to construct the required parameters.  

number_of_latch_executions uses the cache way, it should
not cost much to get the niter.  For the estimated niter
counts, I don't think IVOPTs also checks it.

> Likewise IVOPTs should already consider (does it?) costs
> of invariant computations (the niter computation).
> 

I did check the computation_cost in IVOPTs, but I found
it can not be reused directly for doloop cost check.  So
I had to refactor the prepare_decl_rtl part.  It's 
possible to hack the IVOPTs code to get what we want, 
but it seems too hacky.


> That leaves the CTR invalidation checks which makes
> me wonder if the hook shouldn't be one working on
> a stmt, like stmt_precludes_doloop_p?
> 

This sounds like a better name instead of 
invalid_insn_for_doloop_p.  :)


Thanks,
Kewen

> Richard.
> 

Reply via email to