[llvm] f00f4c5 - [NFC] [llvm] mark MachineLoop get{Bottom,Top}Block const (#216860)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 13:47:49 PDT 2026


Author: Florian Mayer
Date: 2026-08-18T13:47:44-07:00
New Revision: f00f4c54a2ec035375e87b025cc3a894d4cc446d

URL: https://github.com/llvm/llvm-project/commit/f00f4c54a2ec035375e87b025cc3a894d4cc446d
DIFF: https://github.com/llvm/llvm-project/commit/f00f4c54a2ec035375e87b025cc3a894d4cc446d.diff

LOG: [NFC] [llvm] mark MachineLoop get{Bottom,Top}Block const (#216860)

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/MachineLoopInfo.h
    llvm/lib/CodeGen/MachineLoopInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/MachineLoopInfo.h b/llvm/include/llvm/CodeGen/MachineLoopInfo.h
index 8ca01a54532d9..5b38238c62a90 100644
--- a/llvm/include/llvm/CodeGen/MachineLoopInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineLoopInfo.h
@@ -50,12 +50,12 @@ class MachineLoop : public LoopBase<MachineBasicBlock, MachineLoop> {
   /// Return the "top" block in the loop, which is the first block in the linear
   /// layout, ignoring any parts of the loop not contiguous with the part that
   /// contains the header.
-  LLVM_ABI MachineBasicBlock *getTopBlock();
+  LLVM_ABI MachineBasicBlock *getTopBlock() const;
 
   /// Return the "bottom" block in the loop, which is the last block in the
   /// linear layout, ignoring any parts of the loop not contiguous with the part
   /// that contains the header.
-  LLVM_ABI MachineBasicBlock *getBottomBlock();
+  LLVM_ABI MachineBasicBlock *getBottomBlock() const;
 
   /// Find the block that contains the loop control variable and the
   /// loop test. This will return the latch block if it's one of the exiting

diff  --git a/llvm/lib/CodeGen/MachineLoopInfo.cpp b/llvm/lib/CodeGen/MachineLoopInfo.cpp
index a6daa5adfaeaa..943b8746f595f 100644
--- a/llvm/lib/CodeGen/MachineLoopInfo.cpp
+++ b/llvm/lib/CodeGen/MachineLoopInfo.cpp
@@ -98,7 +98,7 @@ void MachineLoopInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
   MachineFunctionPass::getAnalysisUsage(AU);
 }
 
-MachineBasicBlock *MachineLoop::getTopBlock() {
+MachineBasicBlock *MachineLoop::getTopBlock() const {
   MachineBasicBlock *TopMBB = getHeader();
   MachineFunction::iterator Begin = TopMBB->getParent()->begin();
   if (TopMBB->getIterator() != Begin) {
@@ -113,7 +113,7 @@ MachineBasicBlock *MachineLoop::getTopBlock() {
   return TopMBB;
 }
 
-MachineBasicBlock *MachineLoop::getBottomBlock() {
+MachineBasicBlock *MachineLoop::getBottomBlock() const {
   MachineBasicBlock *BotMBB = getHeader();
   MachineFunction::iterator End = BotMBB->getParent()->end();
   if (BotMBB->getIterator() != std::prev(End)) {


        


More information about the llvm-commits mailing list