summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
diff options
context:
space:
mode:
authorSean Silva <chisophugis@gmail.com>2016-05-28 04:19:45 +0000
committerSean Silva <chisophugis@gmail.com>2016-05-28 04:19:45 +0000
commit8c7e12136c267fe525e88c05946f7aee11958ff1 (patch)
tree53a9f85bb3f18296fb4898d734dadee9b5e1dd6c /llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
parent2e8f095b2a8f8aaf05c527563f0b278b589c6857 (diff)
downloadbcm5719-llvm-8c7e12136c267fe525e88c05946f7aee11958ff1.tar.gz
bcm5719-llvm-8c7e12136c267fe525e88c05946f7aee11958ff1.zip
Small cleanup.
Centralize assertion. Clean up max loop. llvm-svn: 271094
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 87970e66a97..a21409f0110 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -691,16 +691,16 @@ void PGOUseFunc::populateCounters() {
}
DEBUG(dbgs() << "Populate counts in " << NumPasses << " passes.\n");
+#ifndef NDEBUG
// Assert every BB has a valid counter.
+ for (auto &BB : F)
+ assert(getBBInfo(&BB).CountValid && "BB count is not valid");
+#endif
uint64_t FuncEntryCount = getBBInfo(&*F.begin()).CountValue;
F.setEntryCount(FuncEntryCount);
uint64_t FuncMaxCount = FuncEntryCount;
- for (auto &BB : F) {
- assert(getBBInfo(&BB).CountValid && "BB count is not valid");
- uint64_t Count = getBBInfo(&BB).CountValue;
- if (Count > FuncMaxCount)
- FuncMaxCount = Count;
- }
+ for (auto &BB : F)
+ FuncMaxCount = std::max(FuncMaxCount, getBBInfo(&BB).CountValue);
markFunctionAttributes(FuncEntryCount, FuncMaxCount);
DEBUG(FuncInfo.dumpInfo("after reading profile."));
OpenPOWER on IntegriCloud