This is an archive of the discontinued LLVM Phabricator instance.

[FastRA] Fix handling of bundled MIs
ClosedPublic

Authored by pdhaliwal on Oct 28 2020, 11:55 PM.

Details

Summary

Fast register allocator skips bundled MIs, as the main assignment
loop uses MachineBasicBlock::iterator (= MachineInstrBundleIterator)
This was causing SIInsertWaitcnts to crash which expects all
instructions to have registers assigned.

This patch makes sure to set everything inside bundle to the same
assignments done on BUNDLE header.

Diff Detail

Event Timeline

pdhaliwal created this revision.Oct 28 2020, 11:55 PM
pdhaliwal requested review of this revision.Oct 28 2020, 11:55 PM

Removed redundant header

qcolombet added inline comments.Nov 4 2020, 9:50 AM
llvm/lib/CodeGen/RegAllocFast.cpp
1450–1456

Could we fix allocateInstruction instead of having a somewhat parallel way of assigning registers?

pdhaliwal added inline comments.Nov 4 2020, 8:45 PM
llvm/lib/CodeGen/RegAllocFast.cpp
1450–1456

If fixing the allocateInstruction means that for each assignment happening over bundle header, a corresponding assignment will happen for bundled instruction, then I am not sure if that is the good way. allocateInstruction has multiple assignment passes over operands. And for each operand's assignment, I would need to get uses and apply the same assignment. Is that what you are thinking of? Or Should I just move the if condition down below to the allocateInstruction?

pdhaliwal added inline comments.Nov 18 2020, 5:56 AM
llvm/lib/CodeGen/RegAllocFast.cpp
1450–1456

Ping!

qcolombet accepted this revision.Dec 18 2020, 5:05 PM
This revision is now accepted and ready to land.Dec 18 2020, 5:05 PM

Update AMDGPU barrier intrinsic

This revision was landed with ongoing or failed builds.Dec 20 2020, 11:11 PM
This revision was automatically updated to reflect the committed changes.