This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ARM] Restrict {load,store}_multiple expanders to MAX_LD_STM_OPS regs
- From: Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Tue, 14 Apr 2015 20:10:40 +0100
- Subject: Re: [PATCH][ARM] Restrict {load,store}_multiple expanders to MAX_LD_STM_OPS regs
- Authentication-results: sourceware.org; auth=none
- References: <552D09F1 dot 3040405 at arm dot com>
- Reply-to: ramrad01 at arm dot com
On Tue, Apr 14, 2015 at 1:37 PM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> Hi all,
>
> The load/store-multiple expanders reject a number of registers outside of
> [2-14]
> but the arm_gen_{load,store}_multiple functions that they called down to
> have an even
> stricter restriction of <= MAX_LDM_STM_OPS that is <= 4. If load_multiple
> was called with
> a number of regs larger than 4 the assert would trigger and we'd ICE.
> This patch fixes that possibility by FAILing in expansion if the number of
> requested
> regs is > MAX_LDM_STM_OPS.
>
> The reason we never hit this currently is that the load,store_multiple
> standard names are
> only used in a single place in expr.c to load the argument registers from to
> a function call.
> By a happy coincidence for arm the number of argument registers is 4 so we
> never exceed that.
> The arm backend never calls the load,store_multiple expanders directly but
> rather the
> arm_gen* functions and it makes sure that they're never called with anything
> > MAX_LDM_STM_OPS.
>
> I hit this issue only due to a buggy change I made to expr.c that ended up
> requesting a
> load_multiple of 5 registers which the expander should have rejected but it
> didn't,
> causing an ICE.
>
> If we add more uses of load/store_multiple in the midend this issue will be
> a loaded gun.
>
> Bootstrapped and tested on arm-none-linux-gnueabihf.
>
> Ok for trunk?
Whoops ! Good catch.
Ok.
Ramana
>
> Thanks,
> Kyrill
>
> 2015-04-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> * config/arm/arm.md (load_multiple): Reject operand 2 greater than
> MAX_LDM_STM_OPS.
> (store_multiple): Likewise.