[PATCH] D118566: [LoopVectorizer] Don't perform interleaving of predicated scalar loops

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 00:52:51 PST 2022


david-arm added a comment.

Hi @dmgreen, from what you're saying it sounds like perhaps the problem is due to two related things:

1. The cost model for interleaving predicated operations is broken in some cases and needs fixing in the long term (since if the code it produces is of such a low quality then it has probably vastly underestimated the cost). I'm not sure if `selectInterleaveCount` really takes the cost into account for the VF=1 case - it lseems to be a selection of bolted-on workarounds/guesses due to the lack of a proper cost model.
2. The loop vectoriser is basically rubbish at unrolling and/or scalarising predicated operations and ultimately in the long term we probably want to fix this. I imagine this is also a problem for VF>1 when the predicated operation has to be scalarised.

One thing to note about your patch is that you are calling `blockNeedsPredicationForAnyReason`, which includes predicated loops (tail-folding). That may be the right thing to do in this case, but I think it's worth adding a test case for it at least?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118566/new/

https://reviews.llvm.org/D118566



More information about the llvm-commits mailing list