Loop Access Analysis

Hi all,

What kind of input loop is expected for the loop-access pass to run smoothly?
Also, what passes (like mem2reg) should be run to ensure the desired form is attained. Is running mem2reg, indvars and loop-simplify enough for that?

Any help will be appreciated.

Thanks and regards,

Hi all,

Just putting this here in case someone else stumbles upon this.

So, it looks like it is important to rotate the loop for the pass to run properly. Running -passes="function(mem2reg,loop(rotate))" started displaying proper analysis.

A related issue was mentioned earlier here

The Loop Optimization Working Group had a survey about “canonical” loop required by each loop transformation or analysis. That is, what should we normalize a loop before running a certain loop pass.

Here is the survey result: https://tinyurl.com/rhuzny2
(Note that there are two workspaces: “By precondition” and “Breakdown”)


  • Min

Hi Min-Yih,

Thanks a lot for the reference. It clears most of my doubts.

Is there any current page for such design decisions (not just about loops) in LLVM - in the documentation (to avoid future questions about them)?

If not, I thought maybe we can add such information in their documentation instead of a sheet (loops only, for now). Is anyone working on this?

I believe the Loop Optimization WG is trying to unify the definition of canonical loop across different loop passes.

You can search “Loop Opt WG meeting minutes” in LLVM mailing list to catch up the progress.


  • Min

Hi Min-Yih,

Thanks for the response. I will go through those emails.