This is an archive of the discontinued LLVM Phabricator instance.

[flang] add DoLoopHelper
ClosedPublic

Authored by schweitz on Jun 11 2020, 2:09 PM.

Details

Summary

This diff adds the helper class for creating fir.do_loop operations.

A fir.do_loop models a Fortran DO loop. It is used to capture Fortran looping constructs for the high-level optimizer.

Diff Detail

Event Timeline

schweitz created this revision.Jun 11 2020, 2:09 PM
Herald added a project: Restricted Project. · View Herald Transcript

Looks clear to me. A couple of questions before i can approve.

flang/lib/Lower/CMakeLists.txt
13

Is this is for a future patch?

Why is there no FIR dependency here?

flang/lib/Lower/DoLoopHelper.cpp
23

What is the story for down counting loops? Where are these handled? can the FIR loop dow count?

schweitz marked 2 inline comments as done.Jun 12 2020, 2:12 PM
schweitz added inline comments.
flang/lib/Lower/CMakeLists.txt
13

I was seeing some build failures locally when trying to slurp in an appropriate sized hunk of code, so it seemed like a good idea to just grab these now. So, yes, these will be needed.

(More to come...)

flang/lib/Lower/DoLoopHelper.cpp
23

fir.do_loop handles count down loops as one would expect. (Step can be a signed integer value, constant or otherwise.)

Code gen (not part of this patch) also correctly lowers fir.do_loop. (The bug has been fixed.)

fir.do_loop thus has different semantics than scf.for.

schweitz updated this revision to Diff 270525.Jun 12 2020, 2:44 PM

Add the reference to FIR ops table gen.
Update one of the MLIR table gen dependences (recent name change).

This revision is now accepted and ready to land.Jun 12 2020, 3:13 PM
This revision was automatically updated to reflect the committed changes.