[PATCH] D111749: [llvm-profgen] Also ignore the first external branch

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 12:22:48 PDT 2021


wlei updated this revision to Diff 379492.
wlei added a comment.

Updating D111749 <https://reviews.llvm.org/D111749>: [llvm-profgen] Also ignore the first external branch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111749/new/

https://reviews.llvm.org/D111749

Files:
  llvm/test/tools/llvm-profgen/inline-noprobe2.test
  llvm/tools/llvm-profgen/PerfReader.cpp


Index: llvm/tools/llvm-profgen/PerfReader.cpp
===================================================================
--- llvm/tools/llvm-profgen/PerfReader.cpp
+++ llvm/tools/llvm-profgen/PerfReader.cpp
@@ -490,9 +490,9 @@
     // if there's no incoming branch before the external branch in reverse
     // order.
     if (IsExternal) {
-      if (PrevTrDst)
+      if (PrevTrDst || LBRStack.empty())
         continue;
-      else if (!LBRStack.empty()) {
+      else {
         WithColor::warning()
             << "Invalid transfer to external code in LBR record at line "
             << TraceIt.getLineNumber() << ": " << TraceIt.getCurrentLine()
Index: llvm/test/tools/llvm-profgen/inline-noprobe2.test
===================================================================
--- llvm/test/tools/llvm-profgen/inline-noprobe2.test
+++ llvm/test/tools/llvm-profgen/inline-noprobe2.test
@@ -1,4 +1,5 @@
-
+; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t  --skip-symbolization --use-offset=0
+; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-RAW-PROFILE
 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t
 ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK
 
@@ -11,6 +12,10 @@
 ; CHECK-SYM-LIST: partition_pivot_last
 ; CHECK-SYM-LIST: quick_sort
 
+
+;CHECK-RAW-PROFILE-NOT: 7f7448e889e4
+;CHECK-RAW-PROFILE-NOT: 7f7448e88826
+
 ;CHECK:       partition_pivot_first:1045:5
 ;CHECK-NEXT:  0: 5
 ;CHECK-NEXT:  1: 5


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111749.379492.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211013/f776d803/attachment.bin>


More information about the llvm-commits mailing list