brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.3 KiB · ef0bb55 Raw
176 lines · plain
1## Ensures that a call continuation fallthrough count is set when using2## pre-aggregated perf data.3 4# RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so5## Link against a DSO to ensure PLT entries.6# RUN: %clangxx %cxxflags %s %t.so -o %t -Wl,-q -nostdlib7# Trace to a call continuation, not a landing pad/entry point8# RUN: link_fdata %s %t %t.pa-base PREAGG-BASE9# Trace from a return to a landing pad/entry point call continuation10# RUN: link_fdata %s %t %t.pa-ret PREAGG-RET11# Trace from an external location to a landing pad/entry point call continuation12# RUN: link_fdata %s %t %t.pa-ext PREAGG-EXT13# Return trace to a landing pad/entry point call continuation14# RUN: link_fdata %s %t %t.pa-pret PREAGG-PRET15# External return to a landing pad/entry point call continuation16# RUN: link_fdata %s %t %t.pa-eret PREAGG-ERET17# RUN-DISABLED: link_fdata %s %t %t.pa-plt PREAGG-PLT18## Fall-through imputing test cases19# RUN: link_fdata %s %t %t.pa-imp PREAGG-IMP20 21# RUN: llvm-strip --strip-unneeded %t -o %t.strip22# RUN: llvm-objcopy --remove-section=.eh_frame %t.strip %t.noeh23 24## Check pre-aggregated traces attach call continuation fallthrough count25## in the basic case (not an entry point, not a landing pad).26# RUN: llvm-bolt %t.noeh --pa -p %t.pa-base -o %t.out \27# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-BASE28 29## Check pre-aggregated traces from a return attach call continuation30## fallthrough count to secondary entry point (unstripped)31# RUN: llvm-bolt %t --pa -p %t.pa-ret -o %t.out \32# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-ATTACH33## Check pre-aggregated traces from a return attach call continuation34## fallthrough count to landing pad (stripped, landing pad)35# RUN: llvm-bolt %t.strip --pa -p %t.pa-ret -o %t.out \36# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-ATTACH37 38## Check pre-aggregated traces from external location don't attach call39## continuation fallthrough count to secondary entry point (unstripped)40# RUN: llvm-bolt %t --pa -p %t.pa-ext -o %t.out \41# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-SKIP42## Check pre-aggregated traces from external location don't attach call43## continuation fallthrough count to landing pad (stripped, landing pad)44# RUN: llvm-bolt %t.strip --pa -p %t.pa-ext -o %t.out \45# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-SKIP46 47## Check pre-aggregated return traces from external location attach call48## continuation fallthrough count to secondary entry point (unstripped)49# RUN: llvm-bolt %t --pa -p %t.pa-pret -o %t.out \50# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-ATTACH51## Check pre-aggregated return traces from external location attach call52## continuation fallthrough count to landing pad (stripped, landing pad)53# RUN: llvm-bolt %t.strip --pa -p %t.pa-pret -o %t.out \54# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-ATTACH55 56## Same for external return type57# RUN: llvm-bolt %t --pa -p %t.pa-eret -o %t.out \58# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-ATTACH59# RUN: llvm-bolt %t.strip --pa -p %t.pa-eret -o %t.out \60# RUN:   --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK-ATTACH61 62## Check pre-aggregated traces don't report zero-sized PLT fall-through as63## invalid trace64# RUN-DISABLED: llvm-bolt %t.strip --pa -p %t.pa-plt -o %t.out | FileCheck %s \65# RUN-DISABLED:   --check-prefix=CHECK-PLT66# CHECK-PLT: traces mismatching disassembled function contents: 067 68## Check --impute-trace-fall-throughs accepting duplicate branch-only traces69# RUN: perf2bolt %t --pa -p %t.pa-imp -o %t.pa-imp.fdata --impute-trace-fall-through70# RUN: FileCheck %s --check-prefix=CHECK-IMP --input-file %t.pa-imp.fdata71# CHECK-IMP: 0 [unknown] 0 1 main {{.*}} 0 372 73  .globl foo74  .type foo, %function75foo:76	pushq	%rbp77	movq	%rsp, %rbp78	popq	%rbp79Lfoo_ret:80	retq81.size foo, .-foo82 83  .globl main84  .type main, %function85main:86.Lfunc_begin0:87	.cfi_startproc88	.cfi_personality 155, DW.ref.__gxx_personality_v089	.cfi_lsda 27, .Lexception090	pushq	%rbp91	movq	%rsp, %rbp92	subq	$0x20, %rsp93	movl	$0x0, -0x4(%rbp)94	movl	%edi, -0x8(%rbp)95	movq	%rsi, -0x10(%rbp)96Ltmp0_br:97	callq	puts@PLT98## Check PLT traces are accepted99# PREAGG-PLT: T #Ltmp0_br# #puts@plt# #puts@plt# 3100## Target is an external-origin call continuation101# PREAGG-BASE: T X:0 #Ltmp1# #Ltmp4_br# 2102# CHECK-BASE:      callq puts@PLT103# CHECK-BASE-NEXT: count: 2104 105Ltmp1:106	movq	-0x10(%rbp), %rax107	movq	0x8(%rax), %rdi108	movl	%eax, -0x14(%rbp)109 110Ltmp4:111	cmpl	$0x0, -0x14(%rbp)112# PREAGG-IMP: B X:0 #Ltmp4_br# 1 0113# PREAGG-IMP: B X:0 #Ltmp4_br# 2 0114Ltmp4_br:115	je	Ltmp0116 117	movl	$0xa, -0x18(%rbp)118	callq	foo119## Target is a binary-local call continuation120# PREAGG-RET: T #Lfoo_ret# #Ltmp3# #Ltmp3_br# 1121## Target is a secondary entry point (unstripped) or a landing pad (stripped)122# PREAGG-EXT: T X:0 #Ltmp3# #Ltmp3_br# 1123## Pre-aggregated return trace124# PREAGG-PRET: R X:0 #Ltmp3# #Ltmp3_br# 1125## External return126# PREAGG-ERET: r #Ltmp3# #Ltmp3_br# 1127 128# CHECK-ATTACH:      callq foo129# CHECK-ATTACH-NEXT: count: 1130# CHECK-SKIP:        callq foo131# CHECK-SKIP-NEXT:   count: 0132 133Ltmp3:134	cmpl	$0x0, -0x18(%rbp)135Ltmp3_br:136	jmp	Ltmp2137 138Ltmp2:139	movl	-0x18(%rbp), %eax140	addl	$-0x1, %eax141	movl	%eax, -0x18(%rbp)142	jmp	Ltmp3143	jmp	Ltmp4144	jmp	Ltmp1145 146Ltmp0:147	xorl	%eax, %eax148	addq	$0x20, %rsp149	popq	%rbp150	retq151.Lfunc_end0:152  .cfi_endproc153.size main, .-main154 155	.section	.gcc_except_table,"a",@progbits156	.p2align	2, 0x0157GCC_except_table0:158.Lexception0:159	.byte	255                             # @LPStart Encoding = omit160	.byte	255                             # @TType Encoding = omit161	.byte	1                               # Call site Encoding = uleb128162	.uleb128 .Lcst_end0-.Lcst_begin0163.Lcst_begin0:164	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<165	.uleb128 .Lfunc_end0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Lfunc_end0166	.uleb128 Ltmp3-.Lfunc_begin0           #     jumps to Ltmp3167	.byte	0                               #     has no landing pad168	.byte	0                               #   On action: cleanup169.Lcst_end0:170	.p2align	2, 0x0171	.hidden	DW.ref.__gxx_personality_v0172	.weak	DW.ref.__gxx_personality_v0173	.section	.data.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat174	.p2align	3, 0x0175	.type	DW.ref.__gxx_personality_v0,@object176