]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Register allocator: fix merging of Unallocated/Spilled vreg.
authorIvo Raisr <ivosh@ivosh.net>
Sun, 1 Oct 2017 05:12:05 +0000 (07:12 +0200)
committerIvo Raisr <ivosh@ivosh.net>
Sun, 1 Oct 2017 05:12:05 +0000 (07:12 +0200)
Spilled vreg has no associated rreg to free.

VEX/priv/host_generic_reg_alloc3.c

index 899fefe5bf8223d41291854efff959532d367f40..81cf5c56c2648fc4388a6b4b2f42d29a1895cb85 100644 (file)
@@ -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);
       }