From: Ivo Raisr Date: Sun, 1 Oct 2017 05:12:05 +0000 (+0200) Subject: Register allocator: fix merging of Unallocated/Spilled vreg. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33053442153eabff2170bf5c862c57c10bc69071;p=thirdparty%2Fvalgrind.git Register allocator: fix merging of Unallocated/Spilled vreg. Spilled vreg has no associated rreg to free. --- diff --git a/VEX/priv/host_generic_reg_alloc3.c b/VEX/priv/host_generic_reg_alloc3.c index 899fefe5bf..81cf5c56c2 100644 --- a/VEX/priv/host_generic_reg_alloc3.c +++ b/VEX/priv/host_generic_reg_alloc3.c @@ -569,7 +569,7 @@ static inline HReg find_vreg_to_spill( incoming instruction stream as possible. An ideal rreg candidate is a callee-save register because it won't be used for parameter passing around helper function calls. */ -static Bool find_free_rreg( +static inline Bool find_free_rreg( const RegAllocChunk* chunk, RegAllocState* state, Short ii_chunk_current, HRegClass target_hregclass, Bool reserve_phase, const RegAllocControl* con, UInt* r_idx_found) @@ -1541,8 +1541,7 @@ static void merge_vreg_states(RegAllocChunk* chunk, case Unallocated: /* Good. Nothing to do. */ break; - case Assigned: /* fall through */ - case Spilled: + case Assigned: /* Should be dead by now. */ vassert(v2_src_state->dead_before <= chunk->next->ii_total_start); @@ -1550,6 +1549,12 @@ static void merge_vreg_states(RegAllocChunk* chunk, FREE_VREG(v2_src_state); FREE_RREG(&state2->rregs[hregIndex(rreg2)]); break; + case Spilled: + /* Should be dead by now. */ + vassert(v2_src_state->dead_before <= chunk->next->ii_total_start); + + FREE_VREG(v2_src_state); + break; default: vassert(0); }