This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Teach performCombineVMergeAndVOps to combine unmasked TU vpmerge with a masked MU TA op.
ClosedPublic

Authored by craig.topper on Mar 3 2023, 1:18 PM.

Details

Summary

We can form a MU TU operation and remove the merge if they use the
same merge value.

My primary interest was a case involving VP intrinsics from our downstream,
but it requires another optimization that isn't in upstream yet. So I've used
RVV intrinsics to get the desired instructions.

Co-authored-by: Nitin John Raj <nitin.raj@sifive.com>

Diff Detail

Event Timeline

craig.topper created this revision.Mar 3 2023, 1:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 1:18 PM
craig.topper requested review of this revision.Mar 3 2023, 1:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 1:18 PM
This revision is now accepted and ready to land.Mar 5 2023, 5:03 AM
frasercrmck added inline comments.Mar 6 2023, 2:22 AM
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
3170

I'm missing the point where the old code "only dealt with VMERGE_VVM which is TU", since the code appears to handle TA just fine.

I can't even see the restriction where "false operand same as its true operand".

We seem to be taking a lot of this comment over to the new code, so I'm wondering if we're accurately describing the behaviour of this peephole.

3209

The nomenclature we're using is a little unclear, using "merge op" to mean two different things in the same sentence. I note you're saying "the vmerge instruction" above - maybe that's clearer?

Improve comments