1 # Meta test using merge-fdata binary
3 # Instrumentation currently only works on X86
4 REQUIRES: x86_64-linux,bolt-runtime
6 # Instrumentation, should test:
8 # - Unmapped calls coming from uninstrumented code (libc)
10 RUN: llvm-bolt merge-fdata -o %t.inst --instrument \
11 RUN: --instrumentation-file=%t.fdata
13 # Execute with no input
14 RUN: %t.inst --version
15 RUN: mv %t.fdata %t.fdata1
17 # Check unmapped calls coverage - libc should be calling _start via
19 RUN: cat %t.fdata1 | FileCheck %s --check-prefix=CHECK-FDATA
20 CHECK-FDATA: 0 [unknown] 0 1 _start 0 0 1
22 # Check that BOLT works with this profile
23 RUN: llvm-bolt merge-fdata -o %t.bolt --data %t.fdata1 \
24 RUN: --reorder-blocks=ext-tsp --reorder-functions=hfsort+ \
25 RUN: --split-functions 2>&1 \
26 RUN: | FileCheck %s --check-prefix=CHECK-BOLT1
27 CHECK-BOLT1-NOT: invalid (possibly stale) profile
31 RUN: mv %t.fdata %t.fdata2
33 # Check profile coverage
34 RUN: llvm-boltdiff merge-fdata merge-fdata \
35 RUN: --data %t.fdata1 --data2 %t.fdata2 --display-count=20 | \
36 RUN: FileCheck %s --check-prefix=CHECK-BOLTDIFF
37 CHECK-BOLTDIFF: Inputs share [[#]] functions
39 # Check that instrumented binary produces the same result
40 RUN: merge-fdata %t.fdata1 %t.fdata2 > %t.fdata.base
41 RUN: %t.inst %t.fdata1 %t.fdata2 > %t.fdata.inst
42 RUN: cmp %t.fdata.base %t.fdata.inst
44 # Optimize using merged fdata
45 RUN: llvm-bolt merge-fdata -o %t.opt --data %t.fdata.base \
46 RUN: --reorder-blocks=ext-tsp --reorder-functions=hfsort+ \
47 RUN: --split-functions 2>&1 \
48 RUN: | FileCheck %s --check-prefix=CHECK-BOLT2
49 CHECK-BOLT2-NOT: invalid (possibly stale) profile
51 # Check that optimized binary produces the same result
52 RUN: %t.opt %t.fdata1 %t.fdata2 > %t.fdata.opt
53 RUN: cmp %t.fdata.base %t.fdata.opt