public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Hanke Zhang <hkzhang455@gmail.com>
Cc: gcc@gcc.gnu.org
Subject: Re: The order of loop traversal in gcc
Date: Mon, 25 Sep 2023 06:46:32 +0100	[thread overview]
Message-ID: <038B4949-AADD-45A9-A22D-8886D6EAD2CC@gmail.com> (raw)
In-Reply-To: <CAM_DAs-oM=-zYJajcTMeP2AsMQSb2q2k_RHCGq29XVCCT51vjg@mail.gmail.com>



> Am 25.09.2023 um 04:53 schrieb Hanke Zhang via Gcc <gcc@gcc.gnu.org>:
> 
> Hi, I have recently been working on loops in gcc, and I have some
> questions about the loop traversal.
> 
> I use loops_list(cfun, LI_ONLY_INNERMOST) to traverse the loops in my
> pass to obtain the loop.
> 
> I found that the order of traversal and the order of actual
> instruction execution will be different.
> 
> Sometimes it's the exact opposite, and sometimes it's sequential. I
> would like to ask how to predict its behavior? And what method should
> I use if I want to obtain sequential traversal?

The order of loops is according to their index, if you require traversal in program order you have to order them yourself, for example by sorting them after their header program order.

Richard 

> Thanks.
> Hanke Zhang.

  reply	other threads:[~2023-09-25  5:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25  3:52 Hanke Zhang
2023-09-25  5:46 ` Richard Biener [this message]
2023-09-25  8:11   ` Hanke Zhang

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=038B4949-AADD-45A9-A22D-8886D6EAD2CC@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=hkzhang455@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).