This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix a silent miscompile in copyPhysReg
ClosedPublic

Authored by reames on Sep 14 2022, 8:45 AM.

Details

Summary

Found this when adding verifier rules. The case which arises is that we have a DefMBBI which has a VecPolicy operand. The code was not expecting this, and the unconditional copy of the last two operands resulted in the SEW and VecPolicy fields being added to the VMV_V_V as AVL and SEW respectively.

Oddly, this appears to be a silent in practice. There's no test change despite verifier changes proving that we definitely hit this in existing tests.

Diff Detail

Event Timeline

reames created this revision.Sep 14 2022, 8:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2022, 8:45 AM
reames requested review of this revision.Sep 14 2022, 8:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2022, 8:45 AM
craig.topper accepted this revision.Sep 14 2022, 2:37 PM

LGTM

I don't think anything looks at the VL or SEW after register allocation which is when copyPhysReg is called. Which is probably why this doesn't affect anything in practice.

This revision is now accepted and ready to land.Sep 14 2022, 2:37 PM
This revision was landed with ongoing or failed builds.Sep 14 2022, 2:46 PM
This revision was automatically updated to reflect the committed changes.