aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InstCount.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-07-18 02:41:12 +0000
committerCraig Topper <craig.topper@intel.com>2017-07-18 02:41:12 +0000
commit9e465894f8127ea058fa35e3744e1ec83fe24b48 (patch)
treed23d003cec0c32acbba4257632ae70ff384cd35f /llvm/lib/Analysis/InstCount.cpp
parent5d77c20a7a06b3390c5e41e9c2bbc4f66edeee7d (diff)
downloadllvm-9e465894f8127ea058fa35e3744e1ec83fe24b48.zip
llvm-9e465894f8127ea058fa35e3744e1ec83fe24b48.tar.gz
llvm-9e465894f8127ea058fa35e3744e1ec83fe24b48.tar.bz2
[Analysis] RemoveTotalMemInst counting in InstCount to avoid reading back other Statistic variables
Summary: Previously, we counted TotalMemInst by reading certain instruction counters before and after calling visit and then finding the difference. But that wouldn't be thread safe if this same pass was being ran on multiple threads. This list of "memory instructions" doesn't make sense to me as it includes call/invoke and is missing atomics. This patch removes the counter all together. Reviewers: hfinkel, chandlerc, davide Reviewed By: davide Subscribers: davide, llvm-commits Differential Revision: https://reviews.llvm.org/D33608 llvm-svn: 308260
Diffstat (limited to 'llvm/lib/Analysis/InstCount.cpp')
-rw-r--r--llvm/lib/Analysis/InstCount.cpp8
1 files changed, 0 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/InstCount.cpp b/llvm/lib/Analysis/InstCount.cpp
index 27c6b58..95ab6ee 100644
--- a/llvm/lib/Analysis/InstCount.cpp
+++ b/llvm/lib/Analysis/InstCount.cpp
@@ -26,7 +26,6 @@ using namespace llvm;
STATISTIC(TotalInsts , "Number of instructions (of all types)");
STATISTIC(TotalBlocks, "Number of basic blocks");
STATISTIC(TotalFuncs , "Number of non-external functions");
-STATISTIC(TotalMemInst, "Number of memory instructions");
#define HANDLE_INST(N, OPCODE, CLASS) \
STATISTIC(Num ## OPCODE ## Inst, "Number of " #OPCODE " insts");
@@ -75,13 +74,6 @@ FunctionPass *llvm::createInstCountPass() { return new InstCount(); }
// function.
//
bool InstCount::runOnFunction(Function &F) {
- unsigned StartMemInsts =
- NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +
- NumInvokeInst + NumAllocaInst;
visit(F);
- unsigned EndMemInsts =
- NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +
- NumInvokeInst + NumAllocaInst;
- TotalMemInst += EndMemInsts-StartMemInsts;
return false;
}