summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-09-20 19:07:22 +0000
committerXinliang David Li <davidxl@google.com>2016-09-20 19:07:22 +0000
commita754c47ac53daa576a0c0899af1f2ef202d08cad (patch)
tree9b52fa773fe379090a1d14bf16ba3a0707e11893 /llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
parent9b5d89513bf4eca8665d4adc37e89f77e27c75c8 (diff)
downloadbcm5719-llvm-a754c47ac53daa576a0c0899af1f2ef202d08cad.tar.gz
bcm5719-llvm-a754c47ac53daa576a0c0899af1f2ef202d08cad.zip
[Profile] code refactoring: make getStep a method in base class
llvm-svn: 282002
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 4f71261a1ab..001468a0433 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -222,14 +222,6 @@ void InstrProfiling::lowerValueProfileInst(InstrProfValueProfileInst *Ind) {
Ind->eraseFromParent();
}
-static Value *getIncrementStep(InstrProfIncrementInst *Inc,
- IRBuilder<> &Builder) {
- auto *IncWithStep = dyn_cast<InstrProfIncrementInstStep>(Inc);
- if (IncWithStep)
- return IncWithStep->getStep();
- return Builder.getInt64(1);
-}
-
void InstrProfiling::lowerIncrement(InstrProfIncrementInst *Inc) {
GlobalVariable *Counters = getOrCreateRegionCounters(Inc);
@@ -237,7 +229,7 @@ void InstrProfiling::lowerIncrement(InstrProfIncrementInst *Inc) {
uint64_t Index = Inc->getIndex()->getZExtValue();
Value *Addr = Builder.CreateConstInBoundsGEP2_64(Counters, 0, Index);
Value *Count = Builder.CreateLoad(Addr, "pgocount");
- Count = Builder.CreateAdd(Count, getIncrementStep(Inc, Builder));
+ Count = Builder.CreateAdd(Count, Inc->getStep());
Inc->replaceAllUsesWith(Builder.CreateStore(Count, Addr));
Inc->eraseFromParent();
}
OpenPOWER on IntegriCloud