[llvm] 9c30bea - [NFC] Mark LI.getLoopsInPreorder and LI.getLoopsInReverseSiblingPreorder const.
Joachim Meyer via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 24 03:27:08 PDT 2021
Author: Joachim Meyer
Date: 2021-09-24T12:31:18+02:00
New Revision: 9c30beaeb228b63447793235570fc207831dd885
URL: https://github.com/llvm/llvm-project/commit/9c30beaeb228b63447793235570fc207831dd885
DIFF: https://github.com/llvm/llvm-project/commit/9c30beaeb228b63447793235570fc207831dd885.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/Analysis/LoopInfo.h
llvm/include/llvm/Analysis/LoopInfoImpl.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h
index ece37dc693cd4..15c9d911ab809 100644
--- a/llvm/include/llvm/Analysis/LoopInfo.h
+++ b/llvm/include/llvm/Analysis/LoopInfo.h
@@ -950,7 +950,7 @@ template <class BlockT, class LoopT> class LoopInfoBase {
///
/// Note that because loops form a forest of trees, preorder is equivalent to
/// reverse postorder.
- SmallVector<LoopT *, 4> getLoopsInPreorder();
+ SmallVector<LoopT *, 4> 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 @@ template <class BlockT, class LoopT> class LoopInfoBase {
///
/// Also note that this is *not* a reverse preorder. Only the siblings are in
/// reverse program order.
- SmallVector<LoopT *, 4> getLoopsInReverseSiblingPreorder();
+ SmallVector<LoopT *, 4> 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 2cc9afb7c2cd8..b8b8330d0fe1d 100644
--- a/llvm/include/llvm/Analysis/LoopInfoImpl.h
+++ b/llvm/include/llvm/Analysis/LoopInfoImpl.h
@@ -574,7 +574,8 @@ void LoopInfoBase<BlockT, LoopT>::analyze(const DomTreeBase<BlockT> &DomTree) {
}
template <class BlockT, class LoopT>
-SmallVector<LoopT *, 4> LoopInfoBase<BlockT, LoopT>::getLoopsInPreorder() {
+SmallVector<LoopT *, 4>
+LoopInfoBase<BlockT, LoopT>::getLoopsInPreorder() const {
SmallVector<LoopT *, 4> 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<LoopT *, 4> LoopInfoBase<BlockT, LoopT>::getLoopsInPreorder() {
template <class BlockT, class LoopT>
SmallVector<LoopT *, 4>
-LoopInfoBase<BlockT, LoopT>::getLoopsInReverseSiblingPreorder() {
+LoopInfoBase<BlockT, LoopT>::getLoopsInReverseSiblingPreorder() const {
SmallVector<LoopT *, 4> 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
More information about the llvm-commits
mailing list