[llvm] [LoopVectorize] Enable hoisting of runtime checks by default (PR #71538)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 23 05:19:00 PST 2023


david-arm wrote:

> I had a look and there are some cases where the more lightweight diff-checks are more profitable than the hoisted checks after [32d1197](https://github.com/llvm/llvm-project/commit/32d1197a8faf4c04df5fcd6c0588aa288bc42e35).
> 
> One particular case is when the start of the AddRecs in the inner loop is the same AddRec in the outer loop, like in
> 
> https://github.com/llvm/llvm-project/blob/fd9a777e018d23d258646af613179eebf6df4b34/llvm/test/Transforms/LoopVectorize/runtime-checks-difference.ll#L279
> 
> It would probably be good to refine the checks when to pick hoisting vs diff checks

Hmm, I guess the trick is to do this in a way that doesn't make x264 slower because I know one of the loops in x264 that benefits from this do have lightweight diff-checks. Even diff checks are still expensive for short inner loops. Do you know of any specific benchmarks where this is a problem? Is https://github.com/llvm/llvm-project/blob/fd9a777e018d23d258646af613179eebf6df4b34/llvm/test/Transforms/LoopVectorize/runtime-checks-difference.ll#L279 the most definitive example of benchmarks you're worried will get slower?

Anyway, I'm happy to take a further look at this and see if I can get the best of both worlds. If necessary the only alternative is to enable this under a TTI hook, but I was hoping to avoid that because it's a very invasive change.

https://github.com/llvm/llvm-project/pull/71538


More information about the llvm-commits mailing list