Skip to content

Commit

Permalink
[MCA][RegisterFile] Consistently update the PRF in the presence of mu…
Browse files Browse the repository at this point in the history
…ltiple writes to the same register.

My last change to the RegisterFile (PR51495) has introduced a bug in the logic
that allocates physical registers in the PRF.

In some cases, this bug could have triggered a nasty unsigned wrap in the number
of allocated registers, thus resulting in mca being stuck forever in a loop of
PRF availability checks.
  • Loading branch information
adibiagio committed Aug 26, 2021
1 parent 9ade9d9 commit 1eb7536
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion llvm/lib/MCA/HardwareUnits/RegisterFile.cpp
Expand Up @@ -294,7 +294,9 @@ void RegisterFile::addRegisterWrite(WriteRef Write,
const WriteState *OtherWS = OtherWrite.getWriteState();
if (OtherWS && OtherWrite.getSourceIndex() == Write.getSourceIndex()) {
if (OtherWS->getLatency() > WS.getLatency()) {
// Conservatively keep the slowest write to RegID.
// Conservatively keep the slowest write on RegID.
if (ShouldAllocatePhysRegs)
allocatePhysRegs(RegisterMappings[RegID].second, UsedPhysRegs);
return;
}
}
Expand Down

0 comments on commit 1eb7536

Please sign in to comment.