diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/include/llvm/Analysis/LoopInfo.h @@ -950,7 +950,7 @@ /// /// Note that because loops form a forest of trees, preorder is equivalent to /// reverse postorder. - SmallVector getLoopsInPreorder(); + SmallVector getLoopsInPreorder() const; /// Return all of the loops in the function in preorder across the loop /// nests, with siblings in *reverse* program order. @@ -960,7 +960,7 @@ /// /// Also note that this is *not* a reverse preorder. Only the siblings are in /// reverse program order. - SmallVector getLoopsInReverseSiblingPreorder(); + SmallVector getLoopsInReverseSiblingPreorder() const; /// Return the inner most loop that BB lives in. If a basic block is in no /// loop (for example the entry node), null is returned. diff --git a/llvm/include/llvm/Analysis/LoopInfoImpl.h b/llvm/include/llvm/Analysis/LoopInfoImpl.h --- a/llvm/include/llvm/Analysis/LoopInfoImpl.h +++ b/llvm/include/llvm/Analysis/LoopInfoImpl.h @@ -574,7 +574,8 @@ } template -SmallVector LoopInfoBase::getLoopsInPreorder() { +SmallVector +LoopInfoBase::getLoopsInPreorder() const { SmallVector PreOrderLoops, PreOrderWorklist; // The outer-most loop actually goes into the result in the same relative // order as we walk it. But LoopInfo stores the top level loops in reverse @@ -592,7 +593,7 @@ template SmallVector -LoopInfoBase::getLoopsInReverseSiblingPreorder() { +LoopInfoBase::getLoopsInReverseSiblingPreorder() const { SmallVector PreOrderLoops, PreOrderWorklist; // The outer-most loop actually goes into the result in the same relative // order as we walk it. LoopInfo stores the top level loops in reverse