Abe,
please avoid comments that are not needed.
+ /* We must copy the insns between the start of the THEN block
+ and the set of 'a', if they exist, since they may be needed
+ for the converted code as well, but we must not copy a
+ start-of-BB note if one is present, nor debug "insn"s. */
+
+ for (rtx_insn* insn = BB_HEAD (then_bb); insn && insn != insn_a
+ && insn != BB_END (then_bb); insn=NEXT_INSN (insn))
+ {
Please remove the braces: the loop body is a single stmt.
+ if (! (NOTE_INSN_BASIC_BLOCK_P (insn) || DEBUG_INSN_P (insn)))
+ duplicate_insn_chain (insn, insn);
+ /* A return of 0 from "duplicate_insn_chain" is _not_
+ a failure; it just returns the "NEXT_INSN" of the
+ last insn it duplicated. */
Please remove this comment.
+ }
+
+ /* Done copying the needed insns between the start of the
+ THEN block and the set of 'a', if any. */
This comment duplicates the same content as the comment before the loop.
Please remove.
On Thu, Oct 8, 2015 at 8:08 AM, Sebastian Pop <[email protected]> wrote:
> 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 <[email protected]> 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
>>