[PATCH] D74115: [llvm-readobj][test] - Add a test for --elf-cg-profile option.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 6 03:19:14 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

This adds a test to document --elf-cg-profile  option we have.
I am going to refactor this area, and this patch is mostly to
create a base for a follow-up change.


https://reviews.llvm.org/D74115

Files:
  llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test


Index: llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-readobj/ELF/call-graph-profile.test
@@ -0,0 +1,40 @@
+## This test checks how we handle --elf-cg-profile option.
+
+# RUN: yaml2obj %s -o %t.o
+# RUN: llvm-readobj %t.o --elf-cg-profile | FileCheck %s --check-prefix=LLVM
+# RUN: llvm-readelf %t.o --elf-cg-profile | FileCheck %s --check-prefix=GNU
+
+# LLVM:      CGProfile [
+# LLVM-NEXT:  CGProfileEntry {
+# LLVM-NEXT:    From: foo (1)
+# LLVM-NEXT:    To: bar (2)
+# LLVM-NEXT:    Weight: 89
+# LLVM-NEXT:  }
+# LLVM-NEXT:  CGProfileEntry {
+# LLVM-NEXT:    From: bar (2)
+# LLVM-NEXT:    To: foo (1)
+# LLVM-NEXT:    Weight: 98
+# LLVM-NEXT:  }
+# LLVM-NEXT: ]
+
+# GNU: GNUStyle::printCGProfile not implemented
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_DYN
+  Machine: EM_X86_64
+Sections:
+  - Name: .llvm.call-graph-profile
+    Type: SHT_LLVM_CALL_GRAPH_PROFILE
+    Entries:
+      - From:   1
+        To:     2
+        Weight: 89
+      - From:   2
+        To:     1
+        Weight: 98
+Symbols:
+  - Name: foo
+  - Name: bar


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74115.242850.patch
Type: text/x-patch
Size: 1207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200206/74deeba9/attachment.bin>


More information about the llvm-commits mailing list