blob: 86e491bcf9c7031983b2920a739c35038518cbce [file] [log] [blame]
# REQUIRES: 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: echo -n "s/<RAW_1_BYTES>/" > %t/raw-single-sed.txt
RUN: od -t x1 -j 32 -An %t/raw-single.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' >> %t/raw-single-sed.txt
RUN: echo "/g" >> %t/raw-single-sed.txt
RUN: sed -f %t/raw-single-sed.txt %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
RUN: llvm-cgdata -m --skip-trim %t/merge-single.o -o %t/merge-single-lazy.cgdata -indexed-codegen-data-lazy-loading
RUN: llvm-cgdata -s %t/merge-single-lazy.cgdata -indexed-codegen-data-lazy-loading | 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 [84 x i8] c"<RAW_1_BYTES>", section "__DATA,__llvm_merge"