on 2020/9/23 下午7:33, Richard Sandiford wrote: > "Kewen.Lin" <li...@linux.ibm.com> writes: >> on 2020/9/22 下午10:34, Richard Sandiford wrote: >>> Also, while splitting out the logic that handles epilogues with >>> constant iterations, I added a check to make sure that we don't >>> try to use partial vectors to vectorise a single-scalar loop. >>> This required some changes to the Power tests. >> >> Thanks for the great rework! Using partial vector should be more >> costly than just being with one single scalar iteration, I think >> this is an improvement. But I'm not sure whether someone would >> argue that in the context of no-vect-cost-model, it's expected to >> go with vectorized code, cost-modeling check can punt this when >> it takes effects. Personally I'm fine on this anyway. > > Yeah, if we costed the epilogue loop against its final iteration > count, we'd hopefully reject it then. But the same problem applies > to costing as to other things: we do the costing based on the number > of iterations of the main loop, rather than on the number of iterations > of the epilogue.
Indeed! The iteration count estimation for epilogue loop is inexact in most cases (VF-1 can only be same as the actual value for V2DI/V2DF). > > FWIW, we don't try to vectorize single-iteration main loops either > (although of course they shouldn't exist in the first place :-)). > So true. :-) BR, Kewen