[llvm-mca] Fixed a problem caused by an invalid use of a processor resource mask in the Scheduler.

The lambda functions used by method ResourceManager::mustIssueImmediately() was
incorrectly truncating masks of buffered processor resources to 32-bit quantities.
The invalid mask values were then used to access a map of processor
resource descriptors.

Fixes PR37643.

llvm-svn: 333692
This commit is contained in:
Andrea Di Biagio 2018-05-31 20:27:46 +00:00
parent 739174c4be
commit 4037011404
1 changed files with 7 additions and 9 deletions

View File

@ -164,18 +164,16 @@ bool ResourceManager::canBeIssued(const InstrDesc &Desc) const {
bool ResourceManager::mustIssueImmediately(const InstrDesc &Desc) {
if (!canBeIssued(Desc))
return false;
bool AllInOrderResources = std::all_of(
Desc.Buffers.begin(), Desc.Buffers.end(), [&](const unsigned BufferMask) {
const ResourceState &Resource = *Resources[BufferMask];
return Resource.isInOrder() || Resource.isADispatchHazard();
});
bool AllInOrderResources = all_of(Desc.Buffers, [&](uint64_t BufferMask) {
const ResourceState &Resource = *Resources[BufferMask];
return Resource.isInOrder() || Resource.isADispatchHazard();
});
if (!AllInOrderResources)
return false;
return std::any_of(Desc.Buffers.begin(), Desc.Buffers.end(),
[&](const unsigned BufferMask) {
return Resources[BufferMask]->isADispatchHazard();
});
return any_of(Desc.Buffers, [&](uint64_t BufferMask) {
return Resources[BufferMask]->isADispatchHazard();
});
}
void ResourceManager::issueInstruction(