88 lines · plain
1# REQUIRES: aarch64-registered-target2# UNSUPPORTED: system-windows3 4# Merge an archive that has two object files having cgdata (__llvm_merge)5 6RUN: split-file %s %t7 8# Synthesize raw cgdata without the header (32 byte) from the indexed cgdata.9RUN: llvm-cgdata --convert --format binary %t/raw-1.cgtext -o %t/raw-1.cgdata10RUN: echo -n "s/<RAW_1_BYTES>/" > %t/raw-1-sed.txt11RUN: od -t x1 -j 32 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' >> %t/raw-1-sed.txt12RUN: echo "/g" >> %t/raw-1-sed.txt13RUN: sed -f %t/raw-1-sed.txt %t/merge-1-template.ll > %t/merge-1.ll14RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-1.ll -o %t/merge-1.o15 16# Synthesize raw cgdata without the header (32 byte) from the indexed cgdata.17RUN: llvm-cgdata --convert --format binary %t/raw-2.cgtext -o %t/raw-2.cgdata18RUN: echo -n "s/<RAW_2_BYTES>/" > %t/raw-2-sed.txt19RUN: od -t x1 -j 32 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' >> %t/raw-2-sed.txt20RUN: echo "/g" >> %t/raw-2-sed.txt21RUN: sed -f %t/raw-2-sed.txt %t/merge-2-template.ll > %t/merge-2.ll22RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-2.ll -o %t/merge-2.o23 24# Make an archive from two object files25RUN: llvm-ar rcs %t/merge-archive.a %t/merge-1.o %t/merge-2.o26 27# Merge the archive into the codegen data file.28RUN: llvm-cgdata --merge --skip-trim %t/merge-archive.a -o %t/merge-archive.cgdata29RUN: llvm-cgdata --show %t/merge-archive.cgdata | FileCheck %s30RUN: llvm-cgdata --merge --skip-trim %t/merge-archive.a -o %t/merge-archive-lazy.cgdata -indexed-codegen-data-lazy-loading31RUN: llvm-cgdata --show %t/merge-archive-lazy.cgdata -indexed-codegen-data-lazy-loading | FileCheck %s32CHECK: Stable function map:33CHECK-NEXT: Unique hash Count: 134CHECK-NEXT: Total function Count: 235CHECK-NEXT: Mergeable function Count: 236 37RUN: llvm-cgdata --convert %t/merge-archive.cgdata| FileCheck %s --check-prefix=MAP38MAP: # Stable function map39MAP-NEXT: :stable_function_map40MAP-NEXT: ---41MAP-NEXT: - Hash: 142MAP-NEXT: FunctionName: Func143MAP-NEXT: ModuleName: Mod144MAP-NEXT: InstCount: 245MAP-NEXT: IndexOperandHashes:46MAP-NEXT: - InstIndex: 047MAP-NEXT: OpndIndex: 148MAP-NEXT: OpndHash: 349MAP-NEXT: - Hash: 150MAP-NEXT: FunctionName: Func251MAP-NEXT: ModuleName: Mod152MAP-NEXT: InstCount: 253MAP-NEXT: IndexOperandHashes:54MAP-NEXT: - InstIndex: 055MAP-NEXT: OpndIndex: 156MAP-NEXT: OpndHash: 457MAP-NEXT: ...58 59;--- raw-1.cgtext60:stable_function_map61- Hash: 162 FunctionName: Func263 ModuleName: Mod164 InstCount: 265 IndexOperandHashes:66 - InstIndex: 067 OpndIndex: 168 OpndHash: 469...70 71;--- merge-1-template.ll72@.data = private unnamed_addr constant [84 x i8] c"<RAW_1_BYTES>", section "__DATA,__llvm_merge"73 74;--- raw-2.cgtext75:stable_function_map76- Hash: 177 FunctionName: Func178 ModuleName: Mod179 InstCount: 280 IndexOperandHashes:81 - InstIndex: 082 OpndIndex: 183 OpndHash: 384...85 86;--- merge-2-template.ll87@.data = private unnamed_addr constant [84 x i8] c"<RAW_2_BYTES>", section "__DATA,__llvm_merge"88