This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Make sure G_ASSERT_ZEXT's src ends up with the same rc as dst
ClosedPublic

Authored by paquette on Jan 29 2021, 4:56 PM.

Details

Summary

When replacing the dst reg with the src reg, we need to make sure that we propagate the dst reg's register class through to the src.

Otherwise, we aren't meeting the requirements for G_ASSERT_ZEXT, and so the verifier will fail.

Diff Detail

Event Timeline

paquette created this revision.Jan 29 2021, 4:56 PM
paquette requested review of this revision.Jan 29 2021, 4:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2021, 4:56 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added inline comments.Jan 29 2021, 5:47 PM
llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
146

!MRI.getRegClassOrNull(SrcReg) should be redundant since this would have been invalid if it weren't the same class anyway

paquette updated this revision to Diff 320259.Jan 29 2021, 6:44 PM

Remove redundant check

This revision is now accepted and ready to land.Jan 29 2021, 10:50 PM