Skip to content

Commit 4075bfc

Browse files
committed
[RegAlloc] Aggressively prefer local reassignment when evicting
1 parent d0278cf commit 4075bfc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,18 @@ bool DefaultEvictionAdvisor::canEvictInterferenceBasedOnCost(
257257
return false;
258258
if (Urgent)
259259
continue;
260+
261+
if (EnableLocalReassign && canReassign(*Intf, PhysReg))
262+
continue;
263+
260264
// Apply the eviction policy for non-urgent evictions.
261265
if (!shouldEvict(VirtReg, IsHint, *Intf, BreaksHint))
262266
return false;
263267
// If !MaxCost.isMax(), then we're just looking for a cheap register.
264268
// Evicting another local live range in this case could lead to suboptimal
265269
// coloring.
266-
if (!MaxCost.isMax() && IsLocal && LIS->intervalIsInOneMBB(*Intf) &&
267-
(!EnableLocalReassign || !canReassign(*Intf, PhysReg))) {
270+
if (!MaxCost.isMax() && IsLocal && LIS->intervalIsInOneMBB(*Intf))
268271
return false;
269-
}
270272
}
271273
}
272274
MaxCost = Cost;

0 commit comments

Comments
 (0)