[llvm] [CodeGen] Add comment to MachineBasicBlock::instrs method. (PR #113868)

Afanasyev Ivan via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 27 23:27:58 PDT 2024


https://github.com/ivafanas created https://github.com/llvm/llvm-project/pull/113868

Add comment that `MachineBasicBlock::instrs` method returns range that iterates over bundled instructions unlike `begin`/`end` methods returns range over bundled instructions.

https://github.com/llvm/llvm-project/pull/113676#pullrequestreview-2396990040


>From 4f24a02ffdf2de9cc4c3ec303cc37c051df9ea84 Mon Sep 17 00:00:00 2001
From: Ivan Afanasyev <ivafanas at gmail.com>
Date: Mon, 28 Oct 2024 13:20:57 +0700
Subject: [PATCH] [CodeGen] Add comment to MachineBasicBlock::instrs method.

---
 llvm/include/llvm/CodeGen/MachineBasicBlock.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index 6cf151c951b19f..a88790ce49a3d8 100644
--- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -346,6 +346,10 @@ class MachineBasicBlock
 
   using instr_range = iterator_range<instr_iterator>;
   using const_instr_range = iterator_range<const_instr_iterator>;
+
+  /// Range that iterates over all instructions in the basic block.
+  ///
+  /// Unlike begin/end methods the range contains bundled instructions.
   instr_range instrs() { return instr_range(instr_begin(), instr_end()); }
   const_instr_range instrs() const {
     return const_instr_range(instr_begin(), instr_end());



More information about the llvm-commits mailing list