73 lines · plain
1# REQUIRES: aarch64-registered-target2# UNSUPPORTED: system-windows3 4# Test merge a single object file having both __llvm_outline and __llvm_merge into a cgdata.5# Effectively, this test combines merge-hashtree.test and merge-funcmap.test.6 7RUN: split-file %s %t8 9# Synthesize raw hashtree bytes without the header (32 byte) from the indexed cgdata.10RUN: llvm-cgdata --convert --format binary %t/raw-hashtree.cgtext -o %t/raw-hashtree.cgdata11RUN: echo -n "s/<RAW_1_BYTES>/" > %t/raw-hashtree-sed.txt12RUN: od -t x1 -j 32 -An %t/raw-hashtree.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' >> %t/raw-hashtree-sed.txt13RUN: echo "/g" >> %t/raw-hashtree-sed.txt14 15# Synthesize raw funcmap bytes without the header (32 byte) from the indexed cgdata.16RUN: llvm-cgdata --convert --format binary %t/raw-funcmap.cgtext -o %t/raw-funcmap.cgdata17RUN: echo -n "s/<RAW_2_BYTES>/" > %t/raw-funcmap-sed.txt18RUN: od -t x1 -j 32 -An %t/raw-funcmap.cgdata | tr -d '\n\r\t' | sed 's/[ ]*$//' | sed 's/[ ][ ]*/\\\\/g' >> %t/raw-funcmap-sed.txt19RUN: echo "/g" >> %t/raw-funcmap-sed.txt20 21# Synthesize a bitcode file by creating two sections for the hash tree and the function map, respectively.22RUN: sed -f %t/raw-hashtree-sed.txt %t/merge-both-template.ll > %t/merge-both-hashtree-template.ll23RUN: sed -f %t/raw-funcmap-sed.txt %t/merge-both-hashtree-template.ll > %t/merge-both-hashtree-funcmap.ll24 25RUN: llc -filetype=obj -mtriple arm64-apple-darwin %t/merge-both-hashtree-funcmap.ll -o %t/merge-both-hashtree-funcmap.o26 27# Merge an object file having cgdata (__llvm_outline and __llvm_merge)28RUN: llvm-cgdata -m --skip-trim %t/merge-both-hashtree-funcmap.o -o %t/merge-both-hashtree-funcmap.cgdata29RUN: llvm-cgdata -s %t/merge-both-hashtree-funcmap.cgdata | FileCheck %s30RUN: llvm-cgdata -m --skip-trim %t/merge-both-hashtree-funcmap.o -o %t/merge-both-hashtree-funcmap-lazy.cgdata -indexed-codegen-data-lazy-loading31RUN: llvm-cgdata -s %t/merge-both-hashtree-funcmap-lazy.cgdata -indexed-codegen-data-lazy-loading | FileCheck %s32 33CHECK: Outlined hash tree:34CHECK-NEXT: Total Node Count: 335CHECK-NEXT: Terminal Node Count: 136CHECK-NEXT: Depth: 237CHECK-NEXT: Stable function map:38CHECK-NEXT: Unique hash Count: 139CHECK-NEXT: Total function Count: 140CHECK-NEXT: Mergeable function Count: 041 42;--- raw-hashtree.cgtext43:outlined_hash_tree440:45 Hash: 0x046 Terminals: 047 SuccessorIds: [ 1 ]481:49 Hash: 0x150 Terminals: 051 SuccessorIds: [ 2 ]522:53 Hash: 0x254 Terminals: 455 SuccessorIds: [ ]56...57 58;--- raw-funcmap.cgtext59:stable_function_map60- Hash: 161 FunctionName: Func162 ModuleName: Mod163 InstCount: 264 IndexOperandHashes:65 - InstIndex: 066 OpndIndex: 167 OpndHash: 368...69 70;--- merge-both-template.ll71@.data1 = private unnamed_addr constant [72 x i8] c"<RAW_1_BYTES>", section "__DATA,__llvm_outline"72@.data2 = private unnamed_addr constant [84 x i8] c"<RAW_2_BYTES>", section "__DATA,__llvm_merge"73