[PATCH] D110268: [llvm-profgen] Fix a bug of assertion

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 10:14:24 PDT 2021


wlei created this revision.
Herald added subscribers: hoy, wenlei, lxfind.
wlei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110268

Files:
  llvm/tools/llvm-profgen/ProfiledBinary.cpp


Index: llvm/tools/llvm-profgen/ProfiledBinary.cpp
===================================================================
--- llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -214,11 +214,12 @@
     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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110268.374281.patch
Type: text/x-patch
Size: 740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210922/94e266d7/attachment.bin>


More information about the llvm-commits mailing list