summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp')
-rw-r--r--llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
index e371f50ed48..3b0d7e4df54 100644
--- a/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
+++ b/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
@@ -147,8 +147,14 @@ ResourceRef ResourceManager::selectPipe(uint64_t ResourceID) {
void ResourceManager::use(const ResourceRef &RR) {
// Mark the sub-resource referenced by RR as used.
- ResourceState &RS = *Resources[getResourceStateIndex(RR.first)];
+ unsigned RSID = getResourceStateIndex(RR.first);
+ ResourceState &RS = *Resources[RSID];
RS.markSubResourceAsUsed(RR.second);
+ // Remember to update the resource strategy for non-group resources with
+ // multiple units.
+ if (RS.getNumUnits() > 1)
+ Strategies[RSID]->used(RR.second);
+
// If there are still available units in RR.first,
// then we are done.
if (RS.isReady())
OpenPOWER on IntegriCloud