[Mlir-commits] [mlir] ccb64cb - [Value] Mark getOperandNumber as Const (#189267)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Mar 30 03:27:16 PDT 2026


Author: Michael Marjieh
Date: 2026-03-30T13:27:11+03:00
New Revision: ccb64cb53e9fcee942a176c1f5a0b0b18e342c82

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

LOG: [Value] Mark getOperandNumber as Const (#189267)

Added: 
    

Modified: 
    mlir/include/mlir/IR/BlockSupport.h
    mlir/include/mlir/IR/Value.h
    mlir/lib/IR/Value.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/BlockSupport.h b/mlir/include/mlir/IR/BlockSupport.h
index a2e080ef4f63f..77c2f314a9345 100644
--- a/mlir/include/mlir/IR/BlockSupport.h
+++ b/mlir/include/mlir/IR/BlockSupport.h
@@ -35,7 +35,7 @@ class BlockOperand : public IROperand<BlockOperand, Block *> {
   static IRObjectWithUseList<BlockOperand> *getUseList(Block *value);
 
   /// Return which operand this is in the BlockOperand list of the Operation.
-  unsigned getOperandNumber();
+  unsigned getOperandNumber() const;
 };
 
 //===----------------------------------------------------------------------===//

diff  --git a/mlir/include/mlir/IR/Value.h b/mlir/include/mlir/IR/Value.h
index e72ace0920eb1..79d3fc5fd8a59 100644
--- a/mlir/include/mlir/IR/Value.h
+++ b/mlir/include/mlir/IR/Value.h
@@ -259,7 +259,7 @@ class OpOperand : public IROperand<OpOperand, Value> {
   }
 
   /// Return which operand this is in the OpOperand list of the Operation.
-  unsigned getOperandNumber();
+  unsigned getOperandNumber() const;
 
   /// Set the current value being used by this operand.
   void assign(Value value) { set(value); }

diff  --git a/mlir/lib/IR/Value.cpp b/mlir/lib/IR/Value.cpp
index fa550e4d5d5d0..cf793680f7efd 100644
--- a/mlir/lib/IR/Value.cpp
+++ b/mlir/lib/IR/Value.cpp
@@ -214,7 +214,7 @@ IRObjectWithUseList<BlockOperand> *BlockOperand::getUseList(Block *value) {
 }
 
 /// Return which operand this is in the operand list.
-unsigned BlockOperand::getOperandNumber() {
+unsigned BlockOperand::getOperandNumber() const {
   return this - &getOwner()->getBlockOperands()[0];
 }
 
@@ -223,6 +223,6 @@ unsigned BlockOperand::getOperandNumber() {
 //===----------------------------------------------------------------------===//
 
 /// Return which operand this is in the operand list.
-unsigned OpOperand::getOperandNumber() {
+unsigned OpOperand::getOperandNumber() const {
   return this - &getOwner()->getOpOperands()[0];
 }


        


More information about the Mlir-commits mailing list