getLoopID has different control flow for two cases: If there is a
single loop latch and for any other number of loop latches (0 and more
than one). The latter case should return the same result if there is
only a single latch. We can save the preceding redundant search for a
latch by handling both cases with the same code.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
save an iteration over the loop's basic blocks (which is what getLoopLatch does)
I'm not sure this is true. getLoopLatch() in LoopInfoImpl.h
only traverses the children of the header in the inverse graph.
That should, I think, be similar to predecessors(Header) in case
of the IR CFG.
That being said, the patch makes sense to me and it is a simple,
straightforward improvement. I don't see any downsides and
it simplifies the code.
LGTM