From 810c256f2114e458ad356a971c0750667fefcbf1 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Tue, 5 Aug 2014 11:48:45 -0700 Subject: [PATCH] Fix register allocator with STORE_LOCAL. May indicate redundant stores. --- src/alloy/compiler/passes/register_allocation_pass.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/alloy/compiler/passes/register_allocation_pass.cc b/src/alloy/compiler/passes/register_allocation_pass.cc index 6f5189ba7..00f60179a 100644 --- a/src/alloy/compiler/passes/register_allocation_pass.cc +++ b/src/alloy/compiler/passes/register_allocation_pass.cc @@ -112,9 +112,11 @@ int RegisterAllocationPass::Run(HIRBuilder* builder) { if (!instr->src1_use->next) { // Pull off preferred register. We will try to reuse this for the // dest. - has_preferred_reg = true; - preferred_reg = instr->src1.value->reg; - assert_not_null(preferred_reg.set); + // NOTE: set may be null if this is a store local. + if (preferred_reg.set) { + has_preferred_reg = true; + preferred_reg = instr->src1.value->reg; + } } }