This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING][RFC][PATCH] RL78 - Add predicates to reduce code bloat when accessing volatile memory.
- From: Andrew Pinski <pinskia at gmail dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: Richard Hulme <peper03 at yahoo dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 9 May 2014 14:57:27 -0700
- Subject: Re: [PING][RFC][PATCH] RL78 - Add predicates to reduce code bloat when accessing volatile memory.
- Authentication-results: sourceware.org; auth=none
- References: <535179B5 dot 6010607 at yahoo dot com> <536D259D dot 9080404 at yahoo dot com> <201405091920 dot s49JKtF4027627 at greed dot delorie dot com>
On Fri, May 9, 2014 at 12:20 PM, DJ Delorie <dj@redhat.com> wrote:
>
> The key to the msp430 change is that I reviewed every pattern that
> used the predicates, and only changed the ones where the pattern was
> known to be volatile-safe. For the RL78, the devirtualizer may make a
> pattern non-volatile-safe, and many patterns are macros which are not
> always volatile-safe.
>
> So, just changing the predicates is probably not enough. Did you
> review every pattern that used the changed predicates, to ensure that
> they're each volatile safe?
More than that, did you review how combine handles volatile memory to
understand why combine does handle volatile memory?
Here is a testcase which combine miscompiles when I tried to have
combine handle volatile:
typedef unsigned long long uint64_t;
typedef unsigned int uint32_t;
union a
{
uint64_t b;
uint32_t c[2];
};
void f(int *r, volatile uint64_t *d)
{
union a e;
e.b = *d;
*r = e.c[1];
}
Thanks,
Andrew Pinski