The order of loop traversal in gcc
Hanke Zhang
hkzhang455@gmail.com
Mon Sep 25 08:11:21 GMT 2023
Richard Biener <richard.guenther@gmail.com> 于2023年9月25日周一 13:46写道:
>
>
>
> > 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. Get it!
> > Thanks.
> > Hanke Zhang.
More information about the Gcc
mailing list