From edf95e51e53697f3050f076675c26a4cece17741 Mon Sep 17 00:00:00 2001 From: Omar Tahir Date: Thu, 9 Jul 2020 10:14:19 +0100 Subject: ira: Fix unnecessary register spill The variables first_moveable_pseudo and last_moveable_pseudo aren't reset after compiling a function, which means they leak into the first scheduler pass of the following function. In some cases, this can cause an extra spill during register allocation of the second function. gcc/ChangeLog: * ira.c (move_unallocated_pseudos): Zero first_moveable_pseudo and last_moveable_pseudo before returning. gcc/testsuite/ChangeLog: * gcc.target/aarch64/nospill.c: New test. --- gcc/ira.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/ira.c') diff --git a/gcc/ira.c b/gcc/ira.c index a655ae1..b748a6d 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5126,6 +5126,8 @@ move_unallocated_pseudos (void) INSN_UID (newinsn), i); SET_REG_N_REFS (i, 0); } + + first_moveable_pseudo = last_moveable_pseudo = 0; } /* If the backend knows where to allocate pseudos for hard -- cgit v1.1