[llvm] [RISCV] Preserve tail agnostic policy in some vector peepholes (PR #105788)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 10:10:26 PDT 2024


lukel97 wrote:

> Can you say a bit about why this helps? It seems slightly odd to me that we need to preserve the policy here. How does doing so fit into your next step?

I'm trying to move the "fold a vmerge into a masked pseudo, where the masks are the same" bit of RISCVDAGToDAGISel::performCombineVMergeAndVOps to RISCVVectorPeephole. We can do this by extending convertVMergeToVMv to detect when the masks are the same, so the vmerge is converted to a vmv.v.v, and then foldVMV_V_V will do the folding.

But if the vmerge's passthru was undef, then the tail is always undef and we can use a ta policy, which is what we currently do in RISCVISelDAGToDAG. When moving this to convertVMergeToVMv, we end up taking the false operand which may be non-undef, but the passthru might have been undef in which case we lose this information. And then separately, we don't propagate the policy in foldVMV_V_V.

This is probably easier to see in the aforementioned patch itself, so I'll post that and point out the regressions that this tries to fix

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


More information about the llvm-commits mailing list