85 lines · plain
1# REQUIRES: aarch64-registered-target2# UNSUPPORTED: system-windows3 4# Merge 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# Merge two object files into the codegen data file.25RUN: llvm-cgdata --merge --skip-trim %t/merge-1.o %t/merge-2.o -o %t/merge.cgdata26RUN: llvm-cgdata --show %t/merge.cgdata | FileCheck %s27RUN: llvm-cgdata --merge --skip-trim %t/merge-1.o %t/merge-2.o -o %t/merge-lazy.cgdata -indexed-codegen-data-lazy-loading28RUN: llvm-cgdata --show %t/merge-lazy.cgdata -indexed-codegen-data-lazy-loading | FileCheck %s29CHECK: Stable function map:30CHECK-NEXT: Unique hash Count: 131CHECK-NEXT: Total function Count: 232CHECK-NEXT: Mergeable function Count: 233 34RUN: llvm-cgdata --convert %t/merge.cgdata | FileCheck %s --check-prefix=MAP35MAP: # Stable function map36MAP-NEXT: :stable_function_map37MAP-NEXT: ---38MAP-NEXT: - Hash: 139MAP-NEXT: FunctionName: Func140MAP-NEXT: ModuleName: Mod141MAP-NEXT: InstCount: 242MAP-NEXT: IndexOperandHashes:43MAP-NEXT: - InstIndex: 044MAP-NEXT: OpndIndex: 145MAP-NEXT: OpndHash: 346MAP-NEXT: - Hash: 147MAP-NEXT: FunctionName: Func248MAP-NEXT: ModuleName: Mod149MAP-NEXT: InstCount: 250MAP-NEXT: IndexOperandHashes:51MAP-NEXT: - InstIndex: 052MAP-NEXT: OpndIndex: 153MAP-NEXT: OpndHash: 454MAP-NEXT: ...55 56;--- raw-1.cgtext57:stable_function_map58- Hash: 159 FunctionName: Func260 ModuleName: Mod161 InstCount: 262 IndexOperandHashes:63 - InstIndex: 064 OpndIndex: 165 OpndHash: 466...67 68;--- merge-1-template.ll69@.data = private unnamed_addr constant [84 x i8] c"<RAW_1_BYTES>", section "__DATA,__llvm_merge"70 71;--- raw-2.cgtext72:stable_function_map73- Hash: 174 FunctionName: Func175 ModuleName: Mod176 InstCount: 277 IndexOperandHashes:78 - InstIndex: 079 OpndIndex: 180 OpndHash: 381...82 83;--- merge-2-template.ll84@.data = private unnamed_addr constant [84 x i8] c"<RAW_2_BYTES>", section "__DATA,__llvm_merge"85