1# REQUIRES: aarch64 2 3# RUN: rm -rf %t && split-file %s %t 4# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/a.s -o %t/a.o 5# RUN: llvm-profdata merge %t/a.proftext -o %t/a.profdata 6 7# RUN: %no-fatal-warnings-lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile-sort=%t/a.profdata --verbose-bp-section-orderer 2>&1 | FileCheck %s --check-prefix=STARTUP 8# RUN: %no-fatal-warnings-lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile-sort=%t/a.profdata --verbose-bp-section-orderer --icf=all --compression-sort=none 2>&1 | FileCheck %s --check-prefix=STARTUP 9 10# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile %t/a.profdata --bp-startup-sort=function --verbose-bp-section-orderer 2>&1 | FileCheck %s --check-prefix=STARTUP 11# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --irpgo-profile=%t/a.profdata --bp-startup-sort=function --verbose-bp-section-orderer --icf=all --bp-compression-sort=none 2>&1 | FileCheck %s --check-prefix=STARTUP 12# STARTUP: Ordered 3 sections using balanced partitioning 13 14# Check that orderfiles take precedence over BP 15# RUN: %no-fatal-warnings-lld -arch arm64 -lSystem -e _main -o - %t/a.o -order_file %t/a.orderfile --irpgo-profile-sort=%t/a.profdata | llvm-nm --numeric-sort --format=just-symbols - | FileCheck %s --check-prefix=ORDERFILE 16# RUN: %lld -arch arm64 -lSystem -e _main -o - %t/a.o -order_file %t/a.orderfile --compression-sort=both | llvm-nm --numeric-sort --format=just-symbols - | FileCheck %s --check-prefix=ORDERFILE 17 18# RUN: %lld -arch arm64 -lSystem -e _main -o - %t/a.o -order_file %t/a.orderfile --irpgo-profile=%t/a.profdata --bp-startup-sort=function | llvm-nm --numeric-sort --format=just-symbols - | FileCheck %s --check-prefix=ORDERFILE 19# RUN: %lld -arch arm64 -lSystem -e _main -o - %t/a.o -order_file %t/a.orderfile --bp-compression-sort=both | llvm-nm --numeric-sort --format=just-symbols - | FileCheck %s --check-prefix=ORDERFILE 20 21# Functions 22# ORDERFILE: A 23# ORDERFILE: F 24# ORDERFILE: E 25# ORDERFILE: D 26# ORDERFILE-DAG: _main 27# ORDERFILE-DAG: _B 28# ORDERFILE-DAG: l_C 29 30# Data 31# ORDERFILE: s3 32# ORDERFILE: r3 33# ORDERFILE: r2 34# ORDERFILE-DAG: s1 35# ORDERFILE-DAG: s2 36# ORDERFILE-DAG: r1 37# ORDERFILE-DAG: r4 38 39# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --compression-sort=function 2>&1 | FileCheck %s --check-prefix=COMPRESSION-FUNC 40# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --compression-sort=data 2>&1 | FileCheck %s --check-prefix=COMPRESSION-DATA 41# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --compression-sort=both 2>&1 | FileCheck %s --check-prefix=COMPRESSION-BOTH 42# RUN: %no-fatal-warnings-lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --compression-sort=both --irpgo-profile-sort=%t/a.profdata 2>&1 | FileCheck %s --check-prefix=COMPRESSION-BOTH 43 44# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --bp-compression-sort=function 2>&1 | FileCheck %s --check-prefix=COMPRESSION-FUNC 45# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --bp-compression-sort=data 2>&1 | FileCheck %s --check-prefix=COMPRESSION-DATA 46# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --bp-compression-sort=both 2>&1 | FileCheck %s --check-prefix=COMPRESSION-BOTH 47# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --bp-compression-sort=both --irpgo-profile=%t/a.profdata --bp-startup-sort=function 2>&1 | FileCheck %s --check-prefix=COMPRESSION-BOTH 48 49# COMPRESSION-FUNC: Ordered 7 sections using balanced partitioning 50# COMPRESSION-DATA: Ordered 7 sections using balanced partitioning 51# COMPRESSION-BOTH: Ordered 14 sections using balanced partitioning 52 53#--- a.s 54.text 55.globl _main, A, _B, l_C.__uniq.111111111111111111111111111111111111111.llvm.2222222222222222222 56 57_main: 58 ret 59A: 60 ret 61_B: 62 add w0, w0, #1 63 bl A 64 ret 65l_C.__uniq.111111111111111111111111111111111111111.llvm.2222222222222222222: 66 add w0, w0, #2 67 bl A 68 ret 69D: 70 add w0, w0, #2 71 bl _B 72 ret 73E: 74 add w0, w0, #2 75 bl l_C.__uniq.111111111111111111111111111111111111111.llvm.2222222222222222222 76 ret 77F: 78 add w0, w0, #3 79 bl l_C.__uniq.111111111111111111111111111111111111111.llvm.2222222222222222222 80 ret 81 82.data 83s1: 84 .ascii "hello world" 85s2: 86 .ascii "i am a string" 87s3: 88 .ascii "this is s3" 89r1: 90 .quad s1 91r2: 92 .quad r1 93r3: 94 .quad r2 95r4: 96 .quad s2 97 98.subsections_via_symbols 99 100#--- a.proftext 101:ir 102:temporal_prof_traces 103# Num Traces 1041 105# Trace Stream Size: 1061 107# Weight 1081 109A, B, C.__uniq.555555555555555555555555555555555555555.llvm.6666666666666666666 110 111A 112# Func Hash: 1131111 114# Num Counters: 1151 116# Counter Values: 1171 118 119B 120# Func Hash: 1212222 122# Num Counters: 1231 124# Counter Values: 1251 126 127C.__uniq.555555555555555555555555555555555555555.llvm.6666666666666666666 128# Func Hash: 1293333 130# Num Counters: 1311 132# Counter Values: 1331 134 135D 136# Func Hash: 1374444 138# Num Counters: 1391 140# Counter Values: 1411 142 143#--- a.orderfile 144A 145F 146E 147D 148s3 149r3 150r2 151