[llvm] c2be2d3 - [llvm-profgen] Fix a bug of assertion
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 22 18:34:04 PDT 2021
Author: wlei
Date: 2021-09-22T18:33:27-07:00
New Revision: c2be2d3284d2b0d76eacbe3e3999fb0843ef65a6
URL: https://github.com/llvm/llvm-project/commit/c2be2d3284d2b0d76eacbe3e3999fb0843ef65a6
DIFF: https://github.com/llvm/llvm-project/commit/c2be2d3284d2b0d76eacbe3e3999fb0843ef65a6.diff
LOG: [llvm-profgen] Fix a bug of assertion
The assertion should work on the entire context.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D110268
Added:
Modified:
llvm/tools/llvm-profgen/ProfiledBinary.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index f817d0c12e40..3a1c5fa62c19 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -219,11 +219,12 @@ ProfiledBinary::getExpandedContext(const SmallVectorImpl<uint64_t> &Stack,
ContextVec.append(ExpandedContext);
}
+ assert(ContextVec.size() && "Context length should be at least 1");
+
// Compress the context string except for the leaf frame
auto LeafFrame = ContextVec.back();
LeafFrame.Callsite = LineLocation(0, 0);
ContextVec.pop_back();
- assert(ContextVec.size() && "Context length should be at least 1");
CSProfileGenerator::compressRecursionContext(ContextVec);
CSProfileGenerator::trimContext(ContextVec);
ContextVec.push_back(LeafFrame);
More information about the llvm-commits
mailing list