public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Amker.Cheng" <amker.cheng@gmail.com>
To: Jeff Law <law@redhat.com>
Cc: Rahul Kharche <rkharche@nvidia.com>,
	"Paulo J. Matos" <paulo@matos-sorge.com>,
		"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: missing conditional propagation in cprop.c pass
Date: Fri, 30 Sep 2011 13:01:00 -0000	[thread overview]
Message-ID: <CAHFci28nxAZc9+CzvNebLTqg2RnEAU_q6QLLV9=3CexhfuOEhQ@mail.gmail.com> (raw)
In-Reply-To: <4E8490DF.7070403@redhat.com>

>>
>> I believe, the optimization you may be referring to is value range
>> propagation which does predication of values based on predicates of
>> conditions. GCC definitely applies VRP at the tree stage, I am not
>> sure if there is an RTL pass to do the same.
> There are also RTL optimizers which perform this kind of constant
> propagation.  See cprop.c (in older versions of gcc this code was in
> gcse.c)
>
Hi Jeff,
This is exactly what I referred in the first message.
Though the cprop.c pass collected the implicit_set information, it is recorded
as local info of basic block, and cprop only does global propagation.
The result is such conditional const propagation opportunities is missed.

The whole process in cprop pass is like:

bb0 : if (x)
then
  bb1
else
  bb2
end

1, implicit_set from the preceding bb0 is tagged as local in bb1;
2, in compute_local_properties, the implicit_set is recorded in avloc[bb1];
3, in compute_cprop_available, the implicit_set is only recorded in avout[bb1],
    not in avin[bb1], which it should be;
4, in cprop_insn and find_avail_set, only info recorded in avin[bb1]
is considered
    when try to do propagation for bb1;

Well, I believe it is a small problem, since implicit_set is recorded
in avout[bb1],
The basic block bb1 is the only one get missed in propagation.

Don't know if I described the problem clearly and please comment.

Thanks very much.

-- 
Best Regards.

  reply	other threads:[~2011-09-30  4:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 14:56 Amker.Cheng
2011-09-29 14:25 ` Amker.Cheng
2011-09-29 15:26 ` Paulo J. Matos
2011-09-29 15:37   ` Amker.Cheng
2011-09-29 15:38     ` Rahul Kharche
2011-09-29 15:39       ` Bernd Schmidt
2011-09-29 16:06         ` Jeff Law
2011-09-29 18:38           ` Bernd Schmidt
2011-09-29 22:46             ` Rahul Kharche
2011-09-30  1:51               ` Jeff Law
2011-09-29 17:20       ` Jeff Law
2011-09-30 13:01         ` Amker.Cheng [this message]
2011-10-03 18:02           ` Jeff Law
2011-09-30  2:51     ` Paulo J. Matos
2011-09-30  9:00       ` Amker.Cheng
2011-10-03 22:30 Steven Bosscher
2011-10-10 10:29 ` Amker.Cheng

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='CAHFci28nxAZc9+CzvNebLTqg2RnEAU_q6QLLV9=3CexhfuOEhQ@mail.gmail.com' \
    --to=amker.cheng@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=paulo@matos-sorge.com \
    --cc=rkharche@nvidia.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).