This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Replace NoX0 SDNodeXForm with a ComplexPattern to do the selection of the VL operand.
ClosedPublic

Authored by craig.topper on Feb 1 2021, 4:07 PM.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 1 2021, 4:07 PM
craig.topper requested review of this revision.Feb 1 2021, 4:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2021, 4:07 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
rogfer01 accepted this revision.Feb 1 2021, 11:23 PM

I admit that I initially wasn't convinced by the idea of ComplexPattern including both the matching logic (which is only return true) and a bit of selection logic (selectImm) in the input DAG. But on a second thought this allows the two logics be kept together.

Also if this is the common way to do this then we better use existing idioms. To be fair that undef in the SDNodeXForm has always looked a bit off to me.

Thanks for the cleanup @craig.topper

This revision is now accepted and ready to land.Feb 1 2021, 11:23 PM

I admit that I initially wasn't convinced by the idea of ComplexPattern including both the matching logic (which is only return true) and a bit of selection logic (selectImm) in the input DAG. But on a second thought this allows the two logics be kept together.

Also if this is the common way to do this then we better use existing idioms. To be fair that undef in the SDNodeXForm has always looked a bit off to me.

Thanks for the cleanup @craig.topper

Yeah the undef looked off to me too.

I'm now wondering if we could extend this further and emit the vsetvli from inside here. If remove the explicit VL and SEWs operands from m the instructions, we might be able to attach the implicit VL physical register def from the vsetvli directly to the implicit physical register use in the instruction. We'd probably need multiple complex patterns to templatize the SEW value and tail policy. The main advantage of this is it might allow us to more directly match the new vsetivli instruction rather than going digging for the immediate from the ADDI instruction in the custom inserter.

This revision was landed with ongoing or failed builds.Feb 2 2021, 12:11 AM
This revision was automatically updated to reflect the committed changes.