public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Kyrill Tkachov <kyrylo.tkachov@arm.com>,
	       Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][RTL-ifcvt] Make non-conditional execution if-conversion more aggressive
Date: Fri, 31 Jul 2015 18:08:00 -0000	[thread overview]
Message-ID: <55BBAFAC.5020608@redhat.com> (raw)
In-Reply-To: <55B75601.7050808@arm.com>

On 07/28/2015 04:14 AM, Kyrill Tkachov wrote:
[ Snip ]


> Here's a respin.
> I've reworked bbs_ok_for_cmove_arith to go over BB_A once and record
> the set registers then go over BB_B once and look inside the SET_SRC
> of each insn for those registers. How does this look? Would you like
> me to investigate the data-flow infrastructure approach?
>
> Also, in bb_valid_for_noce_process_p I iterate through the sub-rtxes
> looking for a MEM with the FOR_EACH_SUBRTX machinery.
>
> As I said above, I think moving the insns rather than re-emitting them
> would make the function more convoluted than I think it needs to be.
>
> Bootstrapped and tested on arm, aarch64, x86_64.
>
>
>
> 2015-07-28  Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
>      * ifcvt.c (struct noce_if_info): Add then_simple, else_simple,
>      then_cost, else_cost fields.  Change branch_cost field to unsigned
> int.
>      (end_ifcvt_sequence): Call set_used_flags on each insn in the
>      sequence.
>      (noce_simple_bbs): New function.
>      (noce_try_move): Bail if basic blocks are not simple.
>      (noce_try_store_flag): Likewise.
>      (noce_try_store_flag_constants): Likewise.
>      (noce_try_addcc): Likewise.
>      (noce_try_store_flag_mask): Likewise.
>      (noce_try_cmove): Likewise.
>      (noce_try_minmax): Likewise.
>      (noce_try_abs): Likewise.
>      (noce_try_sign_mask): Likewise.
>      (noce_try_bitop): Likewise.
>      (bbs_ok_for_cmove_arith): New function.
>      (noce_emit_all_but_last): Likewise.
>      (noce_emit_insn): Likewise.
>      (noce_emit_bb): Likewise.
>      (noce_try_cmove_arith): Handle non-simple basic blocks.
>      (insn_valid_noce_process_p): New function.
>      (contains_mem_rtx_p): Likewise.
>      (bb_valid_for_noce_process_p): Likewise.
>      (noce_process_if_block): Allow non-simple basic blocks
>      where appropriate.
>
> 2015-07-28  Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
>      * gcc.dg/ifcvt-1.c: New test.
>      * gcc.dg/ifcvt-2.c: Likewise.
>      * gcc.dg/ifcvt-3.c: Likewise.
>> Thanks,
>> Kyrill
>>
>>> jeff
>>>
>
>
> ifcvt.patch
>
>
> commit a02417f015b70a0e47170ac7c41a5569392085a5
> Author: Kyrylo Tkachov<kyrylo.tkachov@arm.com>
> Date:   Wed Jul 8 15:45:04 2015 +0100
>
>      [PATCH][ifcvt] Make non-conditional execution if-conversion more aggressive
>
> diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
> index 2d97cc5..dae9b41 100644
> --- a/gcc/ifcvt.c
> +++ b/gcc/ifcvt.c
> @@ -53,6 +53,7 @@
>   #include "tree-pass.h"
>   #include "dbgcnt.h"
>   #include "shrink-wrap.h"
> +#include "rtl-iter.h"
>   #include "ifcvt.h"
Needs to be mentioned in the ChangeLog.

> @@ -1585,6 +1632,116 @@ noce_try_cmove (struct noce_if_info *if_info)
>     return FALSE;
>   }
>
> +/* Return true iff the registers that the insns in BB_A set do not
> +   get used in BB_B.  */
> +
> +static bool
> +bbs_ok_for_cmove_arith (basic_block bb_a, basic_block bb_b)
> +{
> +  rtx_insn *a_insn;
> +  bitmap bba_sets = BITMAP_ALLOC (&reg_obstack);
> +
> +  FOR_BB_INSNS (bb_a, a_insn)
> +    {
> +      if (!active_insn_p (a_insn))
> +	continue;
> +
> +      rtx sset_a = single_set (a_insn);
> +
> +      if (!sset_a)
> +	{
> +	  BITMAP_FREE (bba_sets);
> +	  return false;
> +	}
> +
> +      rtx dest_reg = SET_DEST (sset_a);
> +      bitmap_set_bit (bba_sets, REGNO (dest_reg));
> +    }
So there's a tight relationship between the implementation of 
bbs_ok_for_cmove_arith and insn_valid_noce_process_p.  If there wasn't, 
then we'd probably be looking to use note_stores and note_uses.

With that tight relationship, I think the implementations should be 
close together in the file and a comment in insn_valid_noce_process_p 
indicating that if insn_valid_noce_process_p is changed that the 
implementation of bbs_ok_for_cmove_arith may need to change as well.

One things I am a bit worried about is a SET_DEST that is a ZERO_EXTRACT 
or SUBREG.  Those are usually a read and a write.  So you'd need to 
filter them out earlier (noce_operand_ok?) or handle them in the second 
half of bbs_ok_for_cmove_arith.

Jeff

  reply	other threads:[~2015-07-31 17:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 12:31 Kyrill Tkachov
2015-07-10 13:05 ` Kyrill Tkachov
2015-07-10 23:00 ` Bernhard Reutner-Fischer
2015-07-10 23:08   ` Bernhard Reutner-Fischer
2015-07-13  9:46   ` Kyrill Tkachov
2015-07-13 10:00     ` Kyrill Tkachov
2015-07-13 10:48     ` Bernhard Reutner-Fischer
2015-07-13 13:12       ` Kyrill Tkachov
2015-07-13 14:03     ` Kyrill Tkachov
2015-07-20 10:59       ` Kyrill Tkachov
2015-07-23 20:57       ` Jeff Law
2015-07-24  9:44         ` Kyrill Tkachov
2015-07-24 18:44           ` Jeff Law
2015-07-27 10:30             ` Kyrill Tkachov
2015-07-27 16:14               ` Jeff Law
2015-07-27 17:54                 ` Kyrill Tkachov
2015-07-28 10:21                   ` Kyrill Tkachov
2015-07-31 18:08                     ` Jeff Law [this message]
2015-08-09 21:21                       ` Steven Bosscher
2015-08-11 17:05                         ` Jeff Law
2015-08-11 17:09                           ` Kyrill Tkachov
2015-08-12 14:31                             ` Kyrill Tkachov
2015-08-19 12:59                               ` Kyrill Tkachov
2015-08-19 16:59                               ` Jeff Law
2015-08-19 17:20                                 ` Kyrill Tkachov
2015-08-19 17:38                                   ` Jeff Law
2015-09-02 15:18                                   ` Zamyatin, Igor
2015-09-02 16:02                                     ` Kyrill Tkachov
2015-09-05 15:22                                       ` H.J. Lu
2015-09-02 21:01                                     ` Jeff Law
2015-07-31 17:05                   ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55BBAFAC.5020608@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=rep.dot.nop@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).