This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Preserve vcc_lo when shrinking V_CNDMASK
ClosedPublic

Authored by piotr on Aug 25 2020, 7:31 AM.

Details

Summary

There is no justification for changing vcc_lo to vcc
when shrinking V_CNDMASK, and such a change could
later confuse live variable analysis.

Make sure the original register is preserved.

Diff Detail

Event Timeline

piotr created this revision.Aug 25 2020, 7:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2020, 7:31 AM
piotr requested review of this revision.Aug 25 2020, 7:31 AM
piotr retitled this revision from Preserve the vcc/vcc_lo when shrinking V_CNDMASK to Preserve vcc_lo when shrinking V_CNDMASK.Aug 25 2020, 7:34 AM
arsenm added inline comments.Aug 25 2020, 5:30 PM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
3432

This seems like the wrong place to set this. This implies the registers were mismatched before, and this should be fixed up when the shrunk instruction is created (I guess setting it here isn't that much different)

The way we handle wave32 vs. wave64 is super gross, and we really should have separate instructions.

foad added a subscriber: foad.Aug 26 2020, 1:16 AM
piotr updated this revision to Diff 287895.Aug 26 2020, 3:09 AM

As suggested, moved the code to buildShrunkInst where the instruction is created.

lebedev.ri retitled this revision from Preserve vcc_lo when shrinking V_CNDMASK to [AMDGPU] Preserve vcc_lo when shrinking V_CNDMASK.Aug 26 2020, 3:15 AM
arsenm added inline comments.Aug 26 2020, 5:48 AM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
3479–3484

We have SIInstrInfo::fixImplicitOperands for this

piotr updated this revision to Diff 287963.Aug 26 2020, 6:51 AM

Switched to SIInstrInfo::fixImplicitOperands, thanks.

arsenm accepted this revision.Aug 26 2020, 6:59 AM
This revision is now accepted and ready to land.Aug 26 2020, 6:59 AM
This revision was automatically updated to reflect the committed changes.