[llvm] d0eb472 - [llvm-profdata] Print out section flags for FunctionMetadata section

Hongtao Yu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 17:59:30 PDT 2021


Author: Hongtao Yu
Date: 2021-11-02T17:59:22-07:00
New Revision: d0eb472f334beb66b54a9f329233dd0f95a5b139

URL: https://github.com/llvm/llvm-project/commit/d0eb472f334beb66b54a9f329233dd0f95a5b139
DIFF: https://github.com/llvm/llvm-project/commit/d0eb472f334beb66b54a9f329233dd0f95a5b139.diff

LOG: [llvm-profdata] Print out section flags for  FunctionMetadata section

As titled.

Reviewed By: wenlei, wlei

Differential Revision: https://reviews.llvm.org/D113064

Added: 
    

Modified: 
    llvm/lib/ProfileData/SampleProfReader.cpp
    llvm/test/tools/llvm-profdata/cs-sample-profile.test
    llvm/test/tools/llvm-profdata/merge-probe-profile.test

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index fae5cac795653..c99a19020511f 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -1228,6 +1228,12 @@ static std::string getSecFlagsStr(const SecHdrTableEntry &Entry) {
     if (hasSecFlag(Entry, SecFuncOffsetFlags::SecFlagOrdered))
       Flags.append("ordered,");
     break;
+  case SecFuncMetadata:
+    if (hasSecFlag(Entry, SecFuncMetadataFlags::SecFlagIsProbeBased))
+      Flags.append("probe,");
+    if (hasSecFlag(Entry, SecFuncMetadataFlags::SecFlagHasAttribute))
+      Flags.append("attr,");
+    break;
   default:
     break;
   }

diff  --git a/llvm/test/tools/llvm-profdata/cs-sample-profile.test b/llvm/test/tools/llvm-profdata/cs-sample-profile.test
index 04c573ddece38..ce69a1ffd61a6 100644
--- a/llvm/test/tools/llvm-profdata/cs-sample-profile.test
+++ b/llvm/test/tools/llvm-profdata/cs-sample-profile.test
@@ -2,3 +2,5 @@ RUN: llvm-profdata merge --sample --text -output=%t.proftext %S/Inputs/cs-sample
 RUN: 
diff  -b %t.proftext %S/Inputs/cs-sample.proftext
 RUN: llvm-profdata merge --sample --extbinary %p/Inputs/cs-sample.proftext -o %t.prof && llvm-profdata merge --sample --text %t.prof -o %t1.proftext
 RUN: 
diff  -b %t1.proftext %S/Inputs/cs-sample.proftext
+RUN: llvm-profdata show --sample -show-sec-info-only %t.prof | FileCheck %s
+CHECK: FunctionMetadata {{.*}} Flags: {attr}

diff  --git a/llvm/test/tools/llvm-profdata/merge-probe-profile.test b/llvm/test/tools/llvm-profdata/merge-probe-profile.test
index 448755f89dd65..d05c950728747 100644
--- a/llvm/test/tools/llvm-profdata/merge-probe-profile.test
+++ b/llvm/test/tools/llvm-profdata/merge-probe-profile.test
@@ -22,3 +22,6 @@ MERGE2:  4: 26
 MERGE2:  5: 14 _Z3foov:10 _Z3barv:4
 MERGE2:  6: 12 _Z3barv:8 _Z3foov:4
 MERGE2:  !CFGChecksum: 563022570642068
+
+RUN: llvm-profdata show --sample -show-sec-info-only %t | FileCheck %s
+CHECK: FunctionMetadata {{.*}} Flags: {probe}
\ No newline at end of file


        


More information about the llvm-commits mailing list