1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[MCA] Ignore invalid processor resource writes of zero cycles. NFCI

In debug mode, the tool also raises a warning and prints out a message which
helps identify the problematic MCWriteProcResEntry from the scheduling class.
This message would have been useful to have when triaging PR42282.

llvm-svn: 363387
This commit is contained in:
Andrea Di Biagio 2019-06-14 13:31:21 +00:00
parent ddcd07d19a
commit 9eeb43075a

View File

@ -65,6 +65,17 @@ static void initializeUsedResources(InstrDesc &ID,
for (unsigned I = 0, E = SCDesc.NumWriteProcResEntries; I < E; ++I) { for (unsigned I = 0, E = SCDesc.NumWriteProcResEntries; I < E; ++I) {
const MCWriteProcResEntry *PRE = STI.getWriteProcResBegin(&SCDesc) + I; const MCWriteProcResEntry *PRE = STI.getWriteProcResBegin(&SCDesc) + I;
const MCProcResourceDesc &PR = *SM.getProcResource(PRE->ProcResourceIdx); const MCProcResourceDesc &PR = *SM.getProcResource(PRE->ProcResourceIdx);
if (!PRE->Cycles) {
#ifndef NDEBUG
WithColor::warning()
<< "Ignoring invalid write of zero cycles on processor resource "
<< PR.Name << "\n";
WithColor::note() << "found in scheduling class " << SCDesc.Name
<< " (write index #" << I << ")\n";
#endif
continue;
}
uint64_t Mask = ProcResourceMasks[PRE->ProcResourceIdx]; uint64_t Mask = ProcResourceMasks[PRE->ProcResourceIdx];
if (PR.BufferSize < 0) { if (PR.BufferSize < 0) {
AllInOrderResources = false; AllInOrderResources = false;
@ -190,7 +201,8 @@ static void initializeUsedResources(InstrDesc &ID,
for (const uint64_t R : ID.Buffers) for (const uint64_t R : ID.Buffers)
dbgs() << "\t\tBuffer Mask=" << format_hex(R, 16) << '\n'; dbgs() << "\t\tBuffer Mask=" << format_hex(R, 16) << '\n';
dbgs() << "\t\t Used Units=" << format_hex(ID.UsedProcResUnits, 16) << '\n'; dbgs() << "\t\t Used Units=" << format_hex(ID.UsedProcResUnits, 16) << '\n';
dbgs() << "\t\tUsed Groups=" << format_hex(ID.UsedProcResGroups, 16) << '\n'; dbgs() << "\t\tUsed Groups=" << format_hex(ID.UsedProcResGroups, 16)
<< '\n';
}); });
} }