Index: llvm/include/llvm/Analysis/LoopInfo.h =================================================================== --- llvm/include/llvm/Analysis/LoopInfo.h +++ llvm/include/llvm/Analysis/LoopInfo.h @@ -155,7 +155,11 @@ iterator end() const { return getSubLoops().end(); } reverse_iterator rbegin() const { return getSubLoops().rbegin(); } reverse_iterator rend() const { return getSubLoops().rend(); } + /// Return true if the loop does not contain any sub-loops. bool empty() const { return getSubLoops().empty(); } + bool isInnermost() const { return empty(); } + // Outermost is the same as top-level. + bool isOutermost() const { return getParentLoop() == nullptr; } /// Get a list of the basic blocks which make up this loop. ArrayRef getBlocks() const {