From 8db4d0fbc168b540db6a5bf8950cf28e21087376 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Tue, 25 Jun 2024 09:59:23 -0700 Subject: [PATCH] regalloc: simplifies findOrSpillAllocatable (#2267) Signed-off-by: Takeshi Yoneda --- internal/engine/wazevo/backend/regalloc/regalloc.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/internal/engine/wazevo/backend/regalloc/regalloc.go b/internal/engine/wazevo/backend/regalloc/regalloc.go index b30ffcec8e..bdb5eebccc 100644 --- a/internal/engine/wazevo/backend/regalloc/regalloc.go +++ b/internal/engine/wazevo/backend/regalloc/regalloc.go @@ -267,13 +267,7 @@ func (a *Allocator[I, B]) findOrSpillAllocatable(s *state[I, B], allocatable []R r = RealRegInvalid // First, check if the preferredMask has any allocatable register. if preferred != RealRegInvalid && !forbiddenMask.has(preferred) && !s.regsInUse.has(preferred) { - for _, candidateReal := range allocatable { - // TODO: we should ensure the preferred register is in the allocatable set in the first place, - // but right now, just in case, we check it here. - if candidateReal == preferred { - return preferred - } - } + return preferred } var lastUseAt programCounter