// Check for transient state allocations. If any of the entries listed
// for eviction has a transient state, the allocation fails
+ bool replacement = false;
for (const auto& blk : evict_blks) {
if (blk->isValid()) {
+ replacement = true;
+
Addr repl_addr = regenerateBlkAddr(blk);
MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure());
if (repl_mshr) {
// The victim will be replaced by a new entry, so increase the replacement
// counter if a valid block is being replaced
- if (evict_blks.size() > 0) {
+ if (replacement) {
+ // Evict valid blocks associated to this victim block
for (const auto& blk : evict_blks) {
if (blk->isValid()) {
DPRINTF(CacheRepl, "Evicting %s (%#llx) to make room for " \
"%#llx (%s)\n", blk->print(), regenerateBlkAddr(blk),
addr, is_secure);
- }
- }
- replacements++;
- }
+ if (blk->wasPrefetched()) {
+ unusedPrefetches++;
+ }
- // Evict valid blocks associated to this victim block
- for (const auto& blk : evict_blks) {
- if (blk->isValid()) {
- if (blk->wasPrefetched()) {
- unusedPrefetches++;
+ evictBlock(blk, writebacks);
}
-
- evictBlock(blk, writebacks);
}
+
+ replacements++;
}
// Insert new block at victimized entry