From 9c30beaeb228b63447793235570fc207831dd885 Mon Sep 17 00:00:00 2001 From: Joachim Meyer Date: Fri, 24 Sep 2021 12:01:02 +0200 Subject: [PATCH] [NFC] Mark LI.getLoopsInPreorder and LI.getLoopsInReverseSiblingPreorder const. They create a new vector with the list, so they can be const. Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D110394 --- llvm/include/llvm/Analysis/LoopInfo.h | 4 ++-- llvm/include/llvm/Analysis/LoopInfoImpl.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h index ece37dc..15c9d91 100644 --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/include/llvm/Analysis/LoopInfo.h @@ -950,7 +950,7 @@ public: /// /// 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 @@ public: /// /// 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 index 2cc9afb..b8b8330 100644 --- a/llvm/include/llvm/Analysis/LoopInfoImpl.h +++ b/llvm/include/llvm/Analysis/LoopInfoImpl.h @@ -574,7 +574,8 @@ void LoopInfoBase::analyze(const DomTreeBase &DomTree) { } 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 @@ SmallVector LoopInfoBase::getLoopsInPreorder() { 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 -- 2.7.4