[NFC] Module::getInstructionCount() is const
GitOrigin-RevId: 20ad206b605530b827318cb242db7d6c04b273ea
diff --git a/include/llvm/IR/Module.h b/include/llvm/IR/Module.h
index 6abe675..ca8a49f 100644
--- a/include/llvm/IR/Module.h
+++ b/include/llvm/IR/Module.h
@@ -229,7 +229,7 @@
/// Returns the number of non-debug IR instructions in the module.
/// This is equivalent to the sum of the IR instruction counts of each
/// function contained in the module.
- unsigned getInstructionCount();
+ unsigned getInstructionCount() const;
/// Get the module's original source file name. When compiling from
/// bitcode, this is taken from a bitcode record where it was recorded.
diff --git a/lib/IR/Module.cpp b/lib/IR/Module.cpp
index b9c3663..41666e8 100644
--- a/lib/IR/Module.cpp
+++ b/lib/IR/Module.cpp
@@ -571,9 +571,9 @@
return cast<ConstantInt>(Val->getValue())->getZExtValue();
}
-unsigned Module::getInstructionCount() {
+unsigned Module::getInstructionCount() const {
unsigned NumInstrs = 0;
- for (Function &F : FunctionList)
+ for (const Function &F : FunctionList)
NumInstrs += F.getInstructionCount();
return NumInstrs;
}