public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: 钟居哲 <juzhe.zhong@rivai.ai>
To: richard.sandiford <richard.sandiford@arm.com>,
	 gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "Jeff Law" <jeffreyalaw@gmail.com>,
	 kito.cheng <kito.cheng@gmail.com>,  palmer <palmer@dabbelt.com>
Subject: Re: Re: [PATCH] RISC-V: Fix ICE of visiting non-existing block in CFG.
Date: Wed, 28 Dec 2022 19:57:16 +0800	[thread overview]
Message-ID: <A5CB608F58E740E9+20221228195716037121271@rivai.ai> (raw)
In-Reply-To: <mpt8rir3g2c.fsf@arm.com>

[-- Attachment #1: Type: text/plain, Size: 2213 bytes --]

Yeah, I agree with you that it makes the pass looks confusing that if we are mixing FOR_EACH_BB and for (const bb_info *bb...
But Jeff feels happy if I use FOR_EACH_BB so I send a patch to change the iterator form if it doesn't care about the order.
In this patch, it's ok for both FOR_EACH_BB and for (const bb_info *bb... So I change it as Jeff suggested.

However, in other places of this pass, for example compute_global_backward_infos function, I want to iterate blocks in reverse order and I must use 
"for (const bb_info *bb : crtl->ssa->reverse_bbs ())" which can allow me to do the information backward propagation throughly
so that I can do the aggressive and fancy optimization.

Base on these situations, it will be mixing FOR_EACH_BB and for (const bb_info *bb...  in this pass which may make the pass
a little bit confusing.


juzhe.zhong@rivai.ai
 
From: Richard Sandiford
Date: 2022-12-28 19:47
To: Jeff Law via Gcc-patches
CC: juzhe.zhong; Jeff Law; kito.cheng\@gmail.com; palmer\@dabbelt.com
Subject: Re: [PATCH] RISC-V: Fix ICE of visiting non-existing block in CFG.
Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> On 12/27/22 16:11, juzhe.zhong wrote:
>> You mean only change to this form you suggested in this patch? Since in 
>> all other places of this PASS,I use RTL_SSA framework to iterate 
>> instructions and blocks. I use RTL_SSA framework to iterate blocks here 
>> to make codes look more consistent even though they are same here.
> The FOR_EACH_BB is used far more widely than the C++ style found in 
> RTL-SSA so I'd slightly prefer that style.
 
I can see where you're coming from, but what the patch does is preferred
for RTL-SSA passes.  There is some additional information in
rtl_ssa::bb_info compared to the underlying basic_block, and even if
this particular loop doesn't use that information, IMO it would be
better to avoid mixing styles within a pass.
 
Also, the list that the patch iterates over is in reverse postorder,
whereas FOR_EACH_BB doesn't guarantee a particular order.  Again,
that might not be important here, but it seems better to stick to the
“native” RTL-SSA approach.
 
Thanks,
Richard
 

      reply	other threads:[~2022-12-28 11:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-24  3:08 juzhe.zhong
2022-12-27 21:47 ` Jeff Law
     [not found] ` <91200E8AE78D17FA+15C0DC8B-584B-48FB-B92F-6932C4CCEB51@rivai.ai>
2022-12-28  0:06   ` Jeff Law
2022-12-28  0:24     ` 钟居哲
2022-12-28  1:11       ` Jeff Law
2022-12-28  1:34         ` Kito Cheng
2022-12-28  5:20         ` 钟居哲
2022-12-28 11:47     ` Richard Sandiford
2022-12-28 11:57       ` 钟居哲 [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=A5CB608F58E740E9+20221228195716037121271@rivai.ai \
    --to=juzhe.zhong@rivai.ai \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=richard.sandiford@arm.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).