[PATCH] D115699: [llvm-profgen] Skip disassembling for PLT section

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 22:47:13 PST 2021


wlei created this revision.
Herald added subscribers: hoy, wenlei.
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/D115699

Files:
  llvm/test/tools/llvm-profgen/inline-noprobe2.test
  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
@@ -545,14 +545,18 @@
     // Register the text section.
     TextSections.insert({SectionOffset, SectSize});
 
+    StringRef SectionName = unwrapOrError(Section.getName(), FileName);
+
     if (ShowDisassemblyOnly) {
-      StringRef SectionName = unwrapOrError(Section.getName(), FileName);
       outs() << "\nDisassembly of section " << SectionName;
       outs() << " [" << format("0x%" PRIx64, Section.getAddress()) << ", "
              << format("0x%" PRIx64, Section.getAddress() + SectSize)
              << "]:\n\n";
     }
 
+    if (SectionName.contains(".plt"))
+      continue;
+
     // Get the section data.
     ArrayRef<uint8_t> Bytes =
         arrayRefFromStringRef(unwrapOrError(Section.getContents(), FileName));
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
@@ -8,13 +8,8 @@
 ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t --populate-profile-symbol-list=1
 ; 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-ARTIFICIAL-BRANCH: 0
+; CHECK-ARTIFICIAL-BRANCH: 0
 
 ; CHECK-SYM-LIST: Dump profile symbol list
 ; CHECK-SYM-LIST: main
@@ -78,16 +73,23 @@
 ;CHECK:   1: 5
 ;CHECK:   2: 5
 ;CHECK:   3: 5
-;CHECK: main:820:0
+quick_sort:903:25
+ 1: 24
+ 2: 12 partition_pivot_last:7 partition_pivot_first:5
+ 3: 11 quick_sort:12
+ 4: 12 quick_sort:12
+ 6: 24
+ 65507: 12
+main:486:0
 ;CHECK:  0: 0
 ;CHECK:  3: 0
 ;CHECK:  4.1: 0
 ;CHECK:  4.3: 0
-;CHECK:  5.1: 10
-;CHECK:  5.3: 10
-;CHECK:  6: 10
-;CHECK:  6.1: 12
-;CHECK:  6.3: 10
+;CHECK:  5.1: 6
+;CHECK:  5.3: 6
+;CHECK:  6: 6
+;CHECK:  6.1: 6
+;CHECK:  6.3: 6
 ;CHECK:  7: 0
 ;CHECK:  8: 0 quick_sort:1
 ;CHECK:  9: 0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115699.394145.patch
Type: text/x-patch
Size: 2433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211214/0ecbeeec/attachment.bin>


More information about the llvm-commits mailing list