This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Don't fold AGPR copy pairs that need a temp VGPR
Needs ReviewPublic

Authored by arsenm on Dec 22 2020, 9:51 AM.

Details

Reviewers
rampitec
kerbowa
Summary

Do not fold SGPR->VGPR->AGPR copies, or AGPR->VGPR->AGPR copies. We
need to introduce a temporary VGPR. It's better if this this temp
register is explicitly visible to the register allocator, rather than
relying on the register scavenger later. A future change will
introduce the temporary VGPRs, and this combine would undo that.

Diff Detail

Event Timeline

arsenm created this revision.Dec 22 2020, 9:51 AM
arsenm requested review of this revision.Dec 22 2020, 9:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2020, 9:51 AM
Herald added a subscriber: wdng. · View Herald Transcript
rampitec added inline comments.Dec 22 2020, 10:46 AM
llvm/lib/Target/AMDGPU/SIRegisterInfo.h
175

It is not a part of this change.

I'm working on eliminating some AGPR->VGPR->AGPR copies which commonly cause problems in loops where the VGPR is considered live across iterations by the register allocator even if the VGPR copy should be sunk. Why do we need this temp VGPR?

I'm working on eliminating some AGPR->VGPR->AGPR copies which commonly cause problems in loops where the VGPR is considered live across iterations by the register allocator even if the VGPR copy should be sunk. Why do we need this temp VGPR?

Because you can't directly copy between AGPRs (or directly from SGPR to AGPR)