This method returns whether a block is nested inside of a loop. There
can be two kinds of loop:
- The block is nested inside of a LoopLikeOpInterface
- 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.
I'm slightly nervous about how generally this function is named. Could we make it slightly more specific to LoopLikeInterface, or even make it a static method on the interface class?