[PATCH] D81692: [flang] add DoLoopHelper

Eric Schweitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 14:14:52 PDT 2020


schweitz marked 2 inline comments as done.
schweitz added inline comments.


================
Comment at: flang/lib/Lower/CMakeLists.txt:13
+  MLIRControlFlowInterfaces
+  MLIRLinalgStructuredOpsInterfaceIncGen
+
----------------
kiranchandramohan wrote:
> Is this is for a future patch?
> 
> Why is there no FIR dependency here?
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...)


================
Comment at: flang/lib/Lower/DoLoopHelper.cpp:22
+  auto inc = builder.convertToIndexType(loc, step);
+  auto loop = builder.create<fir::LoopOp>(loc, lbi, ubi, inc);
+  auto insertPt = builder.saveInsertionPoint();
----------------
kiranchandramohan wrote:
> What is the story for down counting loops? Where are these handled? can the FIR loop dow count?
`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`.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81692/new/

https://reviews.llvm.org/D81692





More information about the llvm-commits mailing list