Skip to content

Commit

Permalink
[Analysis] RemoveTotalMemInst counting in InstCount to avoid reading …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
topperc committed Jul 18, 2017
1 parent 5d77c20 commit 9e46589
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions llvm/lib/Analysis/InstCount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}

0 comments on commit 9e46589

Please sign in to comment.