79 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 %S/Inputs/unclaimed-jt-entries.c -no-pie %t.o -o %t.exe -Wl,-q21# RUN: llvm-bolt %t.exe -v=1 -o %t.out --sequential-disassembly 2>&1 | FileCheck %s22 23# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func24# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func25# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func26# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func27# CHECK: BOLT-WARNING: unclaimed data to code reference (possibly an unrecognized jump table entry) to .Ltmp[[#]] in func28# CHECK: BOLT-WARNING: failed to post-process indirect branches for func29 30# Run the optimized binary31# RUN: %t.out 3 | FileCheck %s --check-prefix=CHECK332# CHECK3: 133# RUN: %t.out 4 | FileCheck %s --check-prefix=CHECK434# CHECK4: 235# RUN: %t.out 6 | FileCheck %s --check-prefix=CHECK636# CHECK6: 337# RUN: %t.out 8 | FileCheck %s --check-prefix=CHECK838# CHECK8: 439# RUN: %t.out 13 | FileCheck %s --check-prefix=CHECK1340# CHECK13: 541 42 .text43 .globl func44 .type func, %function45 .size func, .Lend-func46func:47 jmp *L4-24(,%rdi,8)48.L5:49 movl $4, %eax50 ret51.L9:52 movl $2, %eax53 ret54.L8:55 movl $1, %eax56 ret57.L3:58 movl $5, %eax59 ret60.L6:61 movl $3, %eax62 ret63.Lend:64 65.section .rodata66 .globl L467L4:68 .quad .L869 .quad .L970 .quad .L371 .quad .L672 .quad .L373 .quad .L574 .quad .L375 .quad .L376 .quad .L377 .quad .L378 .quad .L379