From 38591d90a3a468bdbc5c7a30bb921054d76e1956 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Wed, 30 Nov 2022 17:28:18 -0800 Subject: [PATCH] fix regalloc --- src/backend/localify.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/backend/localify.rs b/src/backend/localify.rs index a180b40..a9c4db4 100644 --- a/src/backend/localify.rs +++ b/src/backend/localify.rs @@ -3,7 +3,7 @@ use crate::backend::treeify::Trees; use crate::cfg::CFGInfo; -use crate::entity::{EntityRef, EntityVec, PerEntity}; +use crate::entity::{EntityVec, PerEntity}; use crate::ir::{Block, FunctionBody, Local, Type, Value, ValueDef}; use smallvec::{smallvec, SmallVec}; use std::collections::{hash_map::Entry, HashMap}; @@ -187,10 +187,12 @@ impl<'a> Context<'a> { range.end ); - // If the value is an arg, ignore; these already have - // fixed locations. - if value.index() < self.body.n_params { - continue; + // If the value is an arg on block0, ignore; these + // already have fixed locations. + if let &ValueDef::BlockParam(b, _, _) = &self.body.values[value] { + if b == self.body.entry { + continue; + } } // Try getting a local from the freelist; if not,