public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>,
	Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Bill Schmidt <wschmidt@linux.ibm.com>
Subject: Re: [PATCH] predcom: Adjust some unnecessary update_ssa calls
Date: Tue, 8 Jun 2021 08:26:01 -0600	[thread overview]
Message-ID: <4096f519-eb6a-37e1-046d-49cead38e8e7@gmail.com> (raw)
In-Reply-To: <e1d50dbf-533e-3f98-6bba-02f4b8b8bfb4@linux.ibm.com>

On 6/8/21 3:30 AM, Kewen.Lin wrote:
> on 2021/6/7 下午10:46, Richard Biener wrote:
>> On Wed, Jun 2, 2021 at 11:29 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>>>
>>> Hi,
>>>
>>> As Richi suggested in PR100794, this patch is to remove
>>> some unnecessary update_ssa calls with flag
>>> TODO_update_ssa_only_virtuals, also do some refactoring.
>>>
>>> Bootstrapped/regtested on powerpc64le-linux-gnu P9,
>>> x86_64-redhat-linux and aarch64-linux-gnu, built well
>>> on Power9 ppc64le with --with-build-config=bootstrap-O3,
>>> and passed both P8 and P9 SPEC2017 full build with
>>> {-O3, -Ofast} + {,-funroll-loops}.
>>>
>>> Is it ok for trunk?
>>
>> LGTM, minor comment on the fancy C++:
>>
>> +  auto cleanup = [&]() {
>> +    release_chains (chains);
>> +    free_data_refs (datarefs);
>> +    BITMAP_FREE (looparound_phis);
>> +    free_affine_expand_cache (&name_expansions);
>> +  };
>>
>> +      cleanup ();
>> +      return 0;
>>
>> so that could have been
>>
>>    class cleanup {
>>       ~cleanup()
>>          {
>>            release_chains (chains);
>>            free_data_refs (datarefs);
>>            BITMAP_FREE (looparound_phis);
>>            free_affine_expand_cache (&name_expansions);
>>          }
>>    } cleanup;
>>
>> ?  Or some other means of adding registering a RAII-style cleanup?
>> I mean, we can't wrap it all in
>>
>>    try {...}
>>    finally {...}
>>
>> because C++ doesn't have finally.
>>
>> OK with this tiny part of the C++ refactoring delayed, but we can also simply
>> discuss best options.  At least for looparound_phis a good cleanup would
>> be to pass the bitmap around and use auto_bitmap local to
>> tree_predictive_commoning_loop ...
>>
> 
> Thanks Richi!  One draft (not ready for review) is attached for the further
> discussion.  It follows the idea of RAII-style cleanup.  I noticed that
> Martin suggested stepping forward to make tree_predictive_commoning_loop
> and its callees into one class (Thanks Martin), since there are not many
> this kind of C++-style work functions, I want to double confirm which option
> do you guys prefer?

I meant that not necessarily as something to include in this patch
but as a suggestion for a future improvement.  If you'd like to
tackle it at any point that would be great of course :)  In any
event, thanks for double-checking!

The attached patch looks good to me as well (more for the sake of
style than anything else, declaring the class copy ctor and copy 
assignment = delete would make it clear it's not meant to be
copied, although in this case it's unlikely to make a practical
difference).

> 
> One point you might have seen is that to make tree_predictive_commoning_loop
> and its callees as member functions of one class can avoid to pass bitmap
> looparound_phis all around what's in the draft.  :)

Yes, that would simplify the interfaces of all the functions that
the info members are passed to as arguments.

Martin

> 
> BR,
> Kewen
> 


      parent reply	other threads:[~2021-06-08 14:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02  9:29 Kewen.Lin
2021-06-07 14:46 ` Richard Biener
2021-06-07 15:20   ` Martin Sebor
2021-06-08  9:30   ` Kewen.Lin
2021-06-08 11:02     ` Richard Biener
2021-06-08 11:09       ` Richard Biener
2021-06-22  2:35       ` predcom: Refactor more by encapsulating global states Kewen.Lin
2021-06-22 16:14         ` Martin Sebor
2021-06-24  9:26           ` Kewen.Lin
2021-07-19  6:28             ` [PATCH] predcom: Refactor more using auto_vec Kewen.Lin
2021-07-19 20:45               ` Martin Sebor
2021-07-20  2:04                 ` Kewen.Lin
2021-07-20 11:19               ` Richard Biener
2021-06-23  7:22         ` predcom: Refactor more by encapsulating global states Richard Biener
2021-06-24  9:28           ` Kewen.Lin
2021-06-08 14:26     ` Martin Sebor [this message]

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=4096f519-eb6a-37e1-046d-49cead38e8e7@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=linkw@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.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).