[llvm] [CodeGen] Avoid sinking vector comparisons during CodeGenPrepare (PR #113158)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 01:08:29 PDT 2024


david-arm wrote:

> MVE has only a single vector predicate register available, so it might be better to do the sinking. Could you add a test case to check if it looks better?

That's a fair point. I thought this was being tested by existing tests in llvm/test/CodeGen/Thumb2/LowOverheadLoops/fast-fp-loops.ll. I took a look at the results and they seemed to be around 1-2 instructions less overall, but that doesn't mean it's better of course. :) After chatting privately with @paulwalker-arm perhaps it's better to introduce a `hasSingleVectorComparisonRegister` or something like that? For NEON, SVE and presumably AVX this returns a number greater than one. For other targets where the hook returns 1 we sink the comparison. I'll play around with this and see where it leads ...

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


More information about the llvm-commits mailing list