[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 16:38:05 PDT 2021


wlei updated this revision to Diff 379553.
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/Inputs/artificial-branch.perfscript
  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
@@ -492,13 +492,13 @@
     if (IsExternal) {
       if (PrevTrDst)
         continue;
-      else if (!LBRStack.empty()) {
+      if (!LBRStack.empty()) {
         WithColor::warning()
             << "Invalid transfer to external code in LBR record at line "
             << TraceIt.getLineNumber() << ": " << TraceIt.getCurrentLine()
             << "\n";
-        break;
       }
+      break;
     }
 
     if (IsOutgoing) {
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,16 +1,31 @@
-
+; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/artificial-branch.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t  --skip-symbolization --use-offset=0
+; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-ARTIFICIAL-BRANCH
+; 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
 
 ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t
 ; RUN: llvm-profdata show -show-prof-sym-list -sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST
 
+; CHECK-ARTIFICIAL-BRANCH: 3
+; CHECK-ARTIFICIAL-BRANCH: 400540-400540:1
+; CHECK-ARTIFICIAL-BRANCH: 400870-400870:2
+; CHECK-ARTIFICIAL-BRANCH: 400875-4008bf:1
+; CHECK-ARTIFICIAL-BRANCH: 2
+; CHECK-ARTIFICIAL-BRANCH: 400870->400540:2
+; CHECK-ARTIFICIAL-BRANCH: 4008bf->400870:2
+
 ; CHECK-SYM-LIST: Dump profile symbol list
 ; CHECK-SYM-LIST: main
 ; CHECK-SYM-LIST: partition_pivot_first
 ; 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
Index: llvm/test/tools/llvm-profgen/Inputs/artificial-branch.perfscript
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-profgen/Inputs/artificial-branch.perfscript
@@ -0,0 +1 @@
+           400870 0x400870/0x400540/P/-/-/1  0x4008bf/0x400870/P/-/-/7  0x7f7448e88cc1/0x400875/P/-/-/1  0x7f7448e88875/0x7f7448e88cbd/P/-/-/2  0x7f7448e88840/0x7f7448e8885c/P/-/-/1  0x7f7448e8882d/0x7f7448e8883a/P/-/-/1  0x7f7448e889e4/0x7f7448e88826/P/-/-/1  0x7f7448e8899f/0x7f7448e889d8/P/-/-/4  0x7f7448e88821/0x7f7448e88960/P/-/-/1  0x7f7448e887f9/0x7f7448e88815/P/-/-/2  0x7f7448e887e4/0x7f7448e887f2/P/-/-/2  0x7f7448e88cb8/0x7f7448e887c0/P/-/-/1  0x400540/0x7f7448e88cb0/P/-/-/1  0x400870/0x400540/P/-/-/1  0x4008bf/0x400870/P/-/-/5


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


More information about the llvm-commits mailing list