RedundantReloadRemover::run: use cached state rather than allocating it new for each function. (#1118)

RedundantReloadRemover participates in the state-recycling machinery
implemented in cranelift-codegen/src/context.rs, whose goal it is to cache
per-pass state so it can be used for compilation of multiple functions without
reallocation.  Unfortunately RedundantReloadRemover::run simply ignores the
cached state and reallocates it new for each function.  This patch fixes that.
This reduces the number of malloc'd blocks by about 2%.
This commit is contained in:
julian-seward1
2019-10-08 18:13:35 +02:00
committed by GitHub
parent a6af107257
commit 13676cafd1

View File

@@ -887,7 +887,7 @@ impl RedundantReloadRemover {
cur: EncCursor::new(func, isa),
reginfo: isa.register_info(),
cfg: cfg,
state: &mut RedundantReloadRemover::new(),
state: self,
};
let mut total_regunits = 0;
for rb in isa.register_info().banks {