public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
	Andrew MacLeod via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "hernandez, aldy" <aldyh@redhat.com>
Subject: Re: [COMMITTED] process transitive inferred ranges in pre_fold_stmt.
Date: Fri, 11 Nov 2022 18:17:46 -0500	[thread overview]
Message-ID: <3f2de5e6-027f-5669-b656-e4377d9cd2a8@redhat.com> (raw)
In-Reply-To: <20221111225641.66bfbad2@nbbrfq>


On 11/11/22 16:56, Bernhard Reutner-Fischer wrote:
> On Fri, 11 Nov 2022 11:17:17 -0500
> Andrew MacLeod via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
>> diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
>> index 3393c73a7db..a474d9d11e5 100644
>> --- a/gcc/tree-vrp.cc
>> +++ b/gcc/tree-vrp.cc
>> @@ -4485,6 +4486,7 @@ public:
>>       for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
>>   	 gsi_next (&gsi))
>>         m_ranger->register_inferred_ranges (gsi.phi ());
>> +    m_last_bb_stmt = last_stmt (bb);
>>     }
>>   
>>     void post_fold_bb (basic_block bb) override
>> @@ -4497,19 +4499,14 @@ public:
>>     void pre_fold_stmt (gimple *stmt) override
>>     {
>>       m_pta->visit_stmt (stmt);
>> +    // If this is the last stmt and there are inferred ranges, reparse the
>> +    // block for transitive inferred ranges that occur earlier in the block.
>> +    if (stmt == m_last_bb_stmt)
>> +      m_ranger->register_transitive_inferred_ranges (gimple_bb (stmt));
>>     }
> So of course it doesn't really matter what that stmt was, a non_debug
> is as good as a debug one AFAIU, it's just a marker, as good as any SSA
> version or id, i suppose. So gsi_last_nondebug_bb(bb) is not strictly
> needed, fine.
It is important. It needs to be the last non-debug statement so that we 
can properly feed values into the final stmt of the block.. be it a 
conditional, switch or a return.
>
> But since it's last_stmt(), do you have an opinion on 1) in
> https://gcc.gnu.org/pipermail/gcc-help/2021-November/140908.html
> by chance, as you seem to use it..

Not really.  It possible that there is a slightly more efficient way to 
do it, not sure how measurable it would be.  Patches always welcome :-)

Andrew


  reply	other threads:[~2022-11-11 23:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 16:17 Andrew MacLeod
2022-11-11 21:56 ` Bernhard Reutner-Fischer
2022-11-11 23:17   ` Andrew MacLeod [this message]
2022-11-12  7:12     ` Bernhard Reutner-Fischer

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=3f2de5e6-027f-5669-b656-e4377d9cd2a8@redhat.com \
    --to=amacleod@redhat.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).