aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/tools/llvm-cgdata/merge-funcmap-single.test
blob: 9469f1cbda331ca7d4905dd8780a8648ce53c13f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# REQUIRES: shell, aarch64-registered-target
# UNSUPPORTED: system-windows

# Test merge a single object file into a cgdata

RUN: split-file %s %t

# Synthesize raw cgdata without the header (32 byte) from the indexed cgdata.
RUN: llvm-cgdata --convert --format binary %t/raw-single.cgtext -o %t/raw-single.cgdata
RUN: od -t x1 -j 32 -An %t/raw-single.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' > %t/raw-single-bytes.txt

RUN: sed "s/<RAW_1_BYTES>/$(cat %t/raw-single-bytes.txt)/g" %t/merge-single-template.ll > %t/merge-single.ll
RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-single.ll -o %t/merge-single.o

# Merge an object file having cgdata (__llvm_merge)
RUN: llvm-cgdata -m --skip-trim %t/merge-single.o -o %t/merge-single.cgdata
RUN: llvm-cgdata -s %t/merge-single.cgdata | FileCheck %s
CHECK: Stable function map:
CHECK-NEXT:  Unique hash Count: 1
CHECK-NEXT:  Total function Count: 1
CHECK-NEXT:  Mergeable function Count: 0

;--- raw-single.cgtext
:stable_function_map
- Hash:            1
  FunctionName:    Func1
  ModuleName:      Mod1
  InstCount:       2
  IndexOperandHashes:
    - InstIndex:       0
      OpndIndex:       1
      OpndHash:        3
...

;--- merge-single-template.ll
@.data = private unnamed_addr constant [68 x i8] c"<RAW_1_BYTES>", section "__DATA,__llvm_merge"