[PATCH] D159298: [BOLT][test] Move asm-dump.c to runtime/X86

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 10:48:10 PDT 2023


Amir created this revision.
Amir added a reviewer: bolt.
Herald added subscribers: treapster, ayermolo, pengfei, kristof.beyls.
Herald added a reviewer: rafauler.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

Since the test executes instrumented version of the binary, move it under
runtime/X86. Note that it can be adjusted to also run under AArch64 now that
instrumentation is supported.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159298

Files:
  bolt/test/X86/asm-dump.c
  bolt/test/runtime/X86/asm-dump.c


Index: bolt/test/X86/asm-dump.c
===================================================================
--- /dev/null
+++ bolt/test/X86/asm-dump.c
@@ -1,80 +0,0 @@
-/**
- * Test for asm-dump functionality.
- *
- * REQUIRES: system-linux,bolt-runtime
- *
- * Compile the source
- * RUN: %clang -fPIC %s -o %t.exe -Wl,-q
- *
- * Profile collection: instrument the binary
- * RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata -o %t.instr
- *
- * Profile collection: run instrumented binary (and capture output)
- * RUN: %t.instr > %t.result
- *
- * Run BOLT with asm-dump
- * RUN: llvm-bolt %t.exe -p %t.fdata --funcs=main --asm-dump=%t -o /dev/null \
- * RUN:   | FileCheck %s --check-prefix=CHECK-BOLT
- *
- * Check asm file contents
- * RUN: cat %t/main.s | FileCheck %s --check-prefix=CHECK-FILE
- *
- * Now check if asm-dump file can be consumed by BOLT infra
- * Strip dot from compiler-local symbols:
- * RUN: sed -i 's/\.L/L/g' %t/main.s
- *
- * Recompile the asm file into objfile
- * RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o
- *
- * Reconstruct fdata
- * RUN: link_fdata %t/main.s %t.o %t.fdata.reconst
- *
- * XXX: reenable once dumping data is supported
- * Check if reoptimized file produces the same results
- * dontrun: %t.exe.reopt > %t.result.reopt
- * dontrun: cmp %t.result %t.result.reopt
- *
- * Delete our BB symbols so BOLT doesn't mark them as entry points
- * RUN: llvm-strip --strip-unneeded %t.o
- *
- * Recompile the binary
- * RUN: %clang -fPIC %t.o -o %t.exe.reopt -Wl,-q
- *
- * Finally consume reoptimized file with reconstructed fdata
- * RUN: llvm-bolt %t.exe.reopt -p %t.fdata.reconst -o /dev/null \
- * RUN:   | FileCheck %s --check-prefix=CHECK-REOPT
- *
- * CHECK-BOLT: BOLT-INFO: Dumping function assembly to {{.*}}/main.s
- *
- * CHECK-FILE:      .globl main
- * CHECK-FILE-NEXT: .type main, %function
- * CHECK-FILE-NEXT: main:
- * CHECK-FILE-NEXT: # FDATA: 0 [unknown] 0 1 main 0 0 1
- * CHECK-FILE-NEXT: .cfi_startproc
- * CHECK-FILE-NEXT: .LBB{{.*}}:
- * CHECK-FILE:      .cfi_def_cfa_offset 16
- * CHECK-FILE:      leaq  {{.*}}(%rip)
- * CHECK-FILE:      callq puts at PLT
- * CHECK-FILE:      .cfi_endproc
- * CHECK-FILE-NEXT: .size main, .-main
- * CHECK-FILE:      .section .rodata
- *
- * CHECK-REOPT: BOLT-INFO: 1 out of {{.*}} functions in the binary {{.*}} have
- * CHECK-REOPT: non-empty execution profile
- */
-#include <stdio.h>
-#include <string.h>
-
-int main(int argc, char* argv[]) {
-  for (int I = 0; I < 10; I++) {
-    if (I != 9)
-      continue;
-    if (argc > 1 &&
-        strncmp(argv[1], "--help", strlen("--help")) == 0) {
-      puts("Help message\n");
-    } else {
-      puts("Hello, World!\n");
-    }
-  }
-  return 0;
-}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159298.555101.patch
Type: text/x-patch
Size: 2741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230831/10988567/attachment.bin>


More information about the llvm-commits mailing list