llvm.org GIT mirror llvm / e9e0088
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308260 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 3 years ago
1 changed file(s) with 0 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
2525 STATISTIC(TotalInsts , "Number of instructions (of all types)");
2626 STATISTIC(TotalBlocks, "Number of basic blocks");
2727 STATISTIC(TotalFuncs , "Number of non-external functions");
28 STATISTIC(TotalMemInst, "Number of memory instructions");
2928
3029 #define HANDLE_INST(N, OPCODE, CLASS) \
3130 STATISTIC(Num ## OPCODE ## Inst, "Number of " #OPCODE " insts");
7473 // function.
7574 //
7675 bool InstCount::runOnFunction(Function &F) {
77 unsigned StartMemInsts =
78 NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +
79 NumInvokeInst + NumAllocaInst;
8076 visit(F);
81 unsigned EndMemInsts =
82 NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +
83 NumInvokeInst + NumAllocaInst;
84 TotalMemInst += EndMemInsts-StartMemInsts;
8577 return false;
8678 }