This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] combine: Do not combine moves from hard registers
- From: Jeff Law <law at redhat dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>, Renlin Li <renlin dot li at foss dot arm dot com>
- Cc: Christophe Lyon <christophe dot lyon at linaro dot org>, gcc Patches <gcc-patches at gcc dot gnu dot org>, bergner at linux dot ibm dot com
- Date: Fri, 2 Nov 2018 20:34:21 -0600
- Subject: Re: [PATCH] combine: Do not combine moves from hard registers
- References: <68abf72a5400b96b9a100966331d3ad2056648e7.1540237620.git.segher@kernel.crashing.org> <CAKdteOY-201je46aEmH+28BB0e0nNn8Aonyz2BMp-TvehOUFPQ@mail.gmail.com> <20181023122855.GI5205@gate.crashing.org> <CAKdteObR3gOjwd1nxVOdD1U0GVA9CNuQ96y4OcvHLSRGJ-0ZAw@mail.gmail.com> <20181023222645.GT5205@gate.crashing.org> <CAKdteOa4RoWrn+SC=4nPcN4mxtCeWitX7gUPGASR_5UBVM_E5w@mail.gmail.com> <a27db9c8-97c9-9b62-7d62-769c49220229@foss.arm.com> <20181102230320.GV5994@gate.crashing.org> <20181102235422.GW5994@gate.crashing.org>
On 11/2/18 5:54 PM, Segher Boessenkool wrote:
> On Fri, Nov 02, 2018 at 06:03:20PM -0500, Segher Boessenkool wrote:
>>> The original rtx is generated by expand_builtin_setjmp_receiver to adjust
>>> the frame pointer.
>>>
>>> And later in LRA, it will try to eliminate frame_pointer with hard frame
>>> pointer which is
>>> defined the ELIMINABLE_REGS.
>>>
>>> Your change split the insn into two.
>>> This makes it doesn't match the "from" and "to" regs defined in
>>> ELIMINABLE_REGS.
>>> The if statement to generate the adjustment insn is been skipt.
>>> And the original instruction is just been deleted!
>> I don't follow why, or what should have prevented it from being deleted.
>>
>>> Probably, we don't want to split the move rtx if they are related to
>>> entries defined in ELIMINABLE_REGS?
>> One thing I can easily do is not making an intermediate pseudo when copying
>> *to* a fixed reg, which sfp is. Let me try if that helps the testcase I'm
>> looking at (setjmp-4.c).
> This indeed helps, see patch below. Could you try that on the whole
> testsuite?
>
> Thanks,
>
>
> Segher
>
>
> p.s. It still is a problem in the arm backend, but this won't hurt combine,
> so why not.
>
>
> From 814ca23ce05384d017b3c2bff41ab61cf5446e46 Mon Sep 17 00:00:00 2001
> Message-Id: <814ca23ce05384d017b3c2bff41ab61cf5446e46.1541202704.git.segher@kernel.crashing.org>
> From: Segher Boessenkool <segher@kernel.crashing.org>
> Date: Fri, 2 Nov 2018 23:33:32 +0000
> Subject: [PATCH] combine: Don't break up copy from hard to fixed reg
>
> ---
> gcc/combine.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/gcc/combine.c b/gcc/combine.c
> index dfb0b44..15e941a 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -14998,6 +14998,8 @@ make_more_copies (void)
> continue;
> if (TEST_HARD_REG_BIT (fixed_reg_set, REGNO (src)))
> continue;
> + if (REG_P (dest) && TEST_HARD_REG_BIT (fixed_reg_set, REGNO (dest)))
> + continue;
>
> rtx new_reg = gen_reg_rtx (GET_MODE (dest));
> rtx_insn *new_insn = gen_move_insn (new_reg, src);
> -- 1.8.3.1
It certainly helps the armeb test results.
Jeff