This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Split PseudoVSETVLI into 2 instructions to allow different register classes for rs1.
ClosedPublic

Authored by craig.topper on Sep 1 2021, 4:31 PM.

Details

Summary

X0 has special meaning for vsetvli, we need to make sure we never
create it a vsetvli that uses it by accident. This could happen
if the register coalescer coalesces a copy from X0 into this
instruction.

This patch splits the instruction so that we can have GPRNoX0
register class to use for the cases where we don't want the source
to be X0. The verifier won't let us explicitly use X0 on a GPRNoX0
operand so we need a separate pseudo for those cases.

I don't currently have a failing example for this. There was a
failure in D107957, but the coalescable copy from that example
should have been optimized away much earlier so I've fixed that.

This is not a complete fix. We still need to prevent the same
possible issue on the AVL operand of all of the vector instruction
pseudos. I don't want to make two versions of all of those so we
need to find a different solution for those. I have an idea I'm
going to try.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 1 2021, 4:31 PM
craig.topper requested review of this revision.Sep 1 2021, 4:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 4:31 PM
Herald added a subscriber: MaskRay. · View Herald Transcript
frasercrmck accepted this revision.Sep 2 2021, 7:06 AM

Well, I can't think of much to comment on here. I do think this is the "right" thing to do. Thanks again for solving this issue.

This revision is now accepted and ready to land.Sep 2 2021, 7:06 AM
This revision was landed with ongoing or failed builds.Sep 2 2021, 7:45 AM
This revision was automatically updated to reflect the committed changes.