diff options
author | Mircea Trofin <mtrofin@google.com> | 2018-10-18 19:49:44 +0000 |
---|---|---|
committer | Mircea Trofin <mtrofin@google.com> | 2018-10-18 19:49:44 +0000 |
commit | 87b6725c0e01cd422cc551835bea48cd58a94093 (patch) | |
tree | 41490c57a819971296540e7dbb7e7d3eca8c45da /llvm/lib/IR/Function.cpp | |
parent | b09c7787154f227c6719ba595a7e0ea959f41650 (diff) | |
download | bcm5719-llvm-87b6725c0e01cd422cc551835bea48cd58a94093.tar.gz bcm5719-llvm-87b6725c0e01cd422cc551835bea48cd58a94093.zip |
Make Function::getInstructionCount const
Summary: Function::getInstructionCount can be const.
Reviewers: davidxl, paquette
Reviewed By: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53378
llvm-svn: 344754
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 36ba8d0721f..ec094812ceb 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -195,9 +195,9 @@ LLVMContext &Function::getContext() const { return getType()->getContext(); } -unsigned Function::getInstructionCount() { +unsigned Function::getInstructionCount() const { unsigned NumInstrs = 0; - for (BasicBlock &BB : BasicBlocks) + for (const BasicBlock &BB : BasicBlocks) NumInstrs += std::distance(BB.instructionsWithoutDebug().begin(), BB.instructionsWithoutDebug().end()); return NumInstrs; |