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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 01:22:18 PST 2024


david-arm wrote:

> Hi @david-arm, sorry for the late review but when looking at the tests I think I've misunderstood our original conversation. While `hasMultipleConditionRegisters` seems like an overly specific question for the affected code, on reflection I'm not sure that matters.
> 
> Looking at `vector_loop_with_icmp` I can see that not sinking the compare improves the output, but isn't the original output only bad because the code generator is missing an obvious `extractelt (setcc X, C), IndexC => setcc (extractelt X, IndexC), C` combine? which would be better all-round.

I'm happy to have a look at your suggestion and I can believe it helps, but not sure that in general it's a good idea to be sinking unless you can prove the vector comparison will disappear? Anyway, I can try the codegen first and see if this patch still helps on top of it.

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


More information about the llvm-commits mailing list