From patchwork Wed Jun 16 15:57:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 0004-Set-pseudos-only-once.patch Date: Wed, 16 Jun 2010 05:57:32 -0000 From: Maxim Kuvyrkov X-Patchwork-Id: 55905 Message-Id: <4C18F46C.6090809@codesourcery.com> To: Jeff Law , gcc-patches IRA and reload has special relationship with pseudos that are set only once. When such pseudos initialized with constants or instances that can be considered constant across the function, reload can rematerialize them instead of spilling or apply other optimizations. This patch makes sure that we don't unnecessarily set same pseudo more than once. OK to apply? Thank you, diff --git a/gcc/gcse.c b/gcc/gcse.c index 74986a4..45cab70 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -4437,8 +4437,13 @@ hoist_code (void) /* Create a pseudo-reg to store the result of reaching expressions into. Get the mode for the new pseudo - from the mode of the original destination pseudo. */ - if (expr->reaching_reg == NULL) + from the mode of the original destination pseudo. + + It is important to use new pseudos whenever we + emit a set for it in insert_insn_end_basic below. + This will allow reload to use equivalence for + registers that are set only once. */ + if (!insn_inserted_p) expr->reaching_reg = gen_reg_rtx_and_attrs (SET_DEST (set));