Files
clang-p2996/mlir/test/lib/Interfaces/LoopLikeInterface/TestBlockInLoop.cpp
Tom Eccles 81a79ee446 [mlir] Add function for checking if a block is inside a loop
This function returns whether a block is nested inside of a loop. There
can be three kinds of loop:
  1) The block is nested inside of a LoopLikeOpInterface
  2) The block is nested inside another block which is in a loop
  3) There is a cycle in the control flow graph

This will be useful for Flang's stack arrays pass, which moves array
allocations from the heap to the stack. Special handling is needed when
allocations occur inside of loops to ensure additional stack space is
not allocated on each loop iteration.

Differential Revision: https://reviews.llvm.org/D141401
2023-02-10 16:14:17 +00:00

1.5 KiB