This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Look through copies when trying to find an implicit def in addVSetVL.
ClosedPublic

Authored by craig.topper on Mar 12 2021, 5:01 PM.

Details

Summary

The InstrEmitter can sometimes insert a copy after an IMPLICIT_DEF
before connecting it to the vector instruction. This occurs when
constrainRegClass reduces to a class with less than 4 registers.
I believe LMUL8 on masked instructions triggers this since the
result can only use the v8, v16, or v24 register group as the mask
is using v0.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 12 2021, 5:01 PM
craig.topper requested review of this revision.Mar 12 2021, 5:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2021, 5:01 PM
Herald added a subscriber: MaskRay. · View Herald Transcript

It's a shame we can't test this with something like MIR. So it sounds like you're seeing an implicit def of VRM8 and a copy from VRM8 to VRM8NoV0?

Add mir test containing the pattern I'm seeing. Run it through finalize-isel. Without the patch we use 27 instead of 91 for the vsetvli immediate.

frasercrmck accepted this revision.Mar 16 2021, 2:11 AM

Ah yeah I forgot that this is all run during finalize-isel so we can in fact use MIR. Thanks, LGTM.

This revision is now accepted and ready to land.Mar 16 2021, 2:11 AM
This revision was landed with ongoing or failed builds.Mar 16 2021, 8:00 AM
This revision was automatically updated to reflect the committed changes.