This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: using scratchpads to enhance RTL-level if-conversion: revised patch
- From: Sebastian Pop <sebpop at gmail dot com>
- To: Abe <abe_skolnik at yahoo dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Bernd Schmidt <bschmidt at redhat dot com>, Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Date: Thu, 8 Oct 2015 08:08:26 -0500
- Subject: Re: using scratchpads to enhance RTL-level if-conversion: revised patch
- Authentication-results: sourceware.org; auth=none
- References: <5615AADE dot 4030306 at yahoo dot com>
Hi Abe,
could you please avoid double negations, and
please use early returns rather than huge right indentations:
+ if (! not_a_scratchpad_candidate)
+ {
+ if (MEM_SIZE_KNOWN_P (orig_x))
+ {
+ const size_t size_of_MEM = MEM_SIZE (orig_x);
+
+ if (size_of_MEM <= SCRATCHPAD_MAX_SIZE)
+ {
[...]
+ }
+ }
+ }
+ return FALSE;
Just rewrite as:
if (not_a_scratchpad_candidate
|| !MEM_SIZE_KNOWN_P (orig_x))
return FALSE;
const size_t size_of_MEM = MEM_SIZE (orig_x);
if (size_of_MEM > SCRATCHPAD_MAX_SIZE)
return FALSE;
That will save 3 levels of indent.
Also some of your braces do not seem to be correctly placed.
Please use clang-format on your patch to solve the indentation issues.
Thanks,
Sebastian
On Wed, Oct 7, 2015 at 6:29 PM, Abe <abe_skolnik@yahoo.com> wrote:
> Dear all,
>
> Attached please find my revised patch to the RTL if converter. This patch
> enables the
> if-conversion of half-hammocks with a store in them that the internal GCC
> machinery
> otherwise considers too hazardous to if-convert. This is made safe by using
> the
> "scratchpad" technique, i.e. throwing away the store into a safe location
> where nothing
> of any importance is currently stored. The scratchpads are allocated in the
> stack frame.
>
> Here is an example of code which is newly converted with this patch,
> at least when targeting AArch64:
>
> int A[10];
>
> void half_hammock() {
> if (A[0])
> A[1] = 2;
> }
>
>
> Both tested against trunk and bootstrapped OK with defaults* on
> AMD64-AKA-"x86_64" GNU/Linux.
>
> '*': [except for "--prefix"]
>
>
> I`m sending the patch as an attachment to avoid it
> being corrupted/reformatted by any e-mail troubles.
>
> I look forward to your feedback.
>
> Regards,
>
> Abe
>