81 lines · plain
1## This test ensures that "unclaimed" jump table entries are accounted later2## in postProcessIndirectBranches and the function is marked as non-simple.3 4# The test is compiled from the following source using GCC 12.2 -O3:5# https://godbolt.org/z/YcPG131s66# int func(long long Input) {7# switch(Input) {8# case 3: return 1;9# case 4: return 2;10# case 6: return 3;11# case 8: return 4;12# case 13: return 5;13# default: __builtin_unreachable();14# }15# }16 17# REQUIRES: system-linux18 19# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o20# RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q21 22## Check that non-simple function profile is emitted in perf2bolt mode23# RUN: link_fdata %s %t.exe %t.pa PREAGG24# RUN: llvm-strip -N L5 -N L5_ret %t.exe25# RUN: perf2bolt %t.exe -p %t.pa --pa -o %t.fdata -strict=0 -print-profile \26# RUN: -print-only=main | FileCheck %s --check-prefix=CHECK-P2B27# CHECK-P2B: PERF2BOLT: traces mismatching disassembled function contents: 028# CHECK-P2B: Binary Function "main"29# CHECK-P2B: IsSimple : 030# RUN: FileCheck %s --input-file %t.fdata --check-prefix=CHECK-FDATA31# CHECK-FDATA: 1 main 0 1 main 7 0 132 33# RUN: llvm-bolt %t.exe -v=1 -o %t.out 2>&1 | FileCheck %s34 35# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main36# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main37# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main38# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main39# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in main40# CHECK: BOLT-WARNING: failed to post-process indirect branches for main41 42 .text43 .globl main44 .type main, %function45 .size main, .Lend-main46main:47 jmp *L4-24(,%rdi,8)48# PREAGG: T #main# #L5# #L5_ret# 149L5:50 movl $4, %eax51L5_ret:52 ret53.L9:54 movl $2, %eax55 ret56.L8:57 movl $1, %eax58 ret59.L3:60 movl $5, %eax61 ret62.L6:63 movl $3, %eax64 ret65.Lend:66 67.section .rodata68 .globl L469L4:70 .quad .L871 .quad .L972 .quad .L373 .quad .L674 .quad .L375 .quad L576 .quad .L377 .quad .L378 .quad .L379 .quad .L380 .quad .L381