45 lines · plain
1## This reproduces a bug with dynostats when trying to compute branch stats2## at a block with two tails calls (one conditional and one unconditional).3 4# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \5# RUN: %s -o %t.o6# RUN: link_fdata %s %t.o %t.fdata7# RUN: llvm-strip --strip-unneeded %t.o8# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib9# RUN: llvm-bolt %t.exe -o %t.out --data %t.fdata --lite=0 --dyno-stats \10# RUN: --print-sctc --print-only=_start -enable-bat 2>&1 | FileCheck %s11# RUN: llvm-objdump --syms %t.out > %t.log12# RUN: llvm-bat-dump %t.out --dump-all >> %t.log13# RUN: FileCheck %s --input-file %t.log --check-prefix=CHECK-BAT14 15# CHECK-NOT: Assertion `BranchInfo.size() == 2 && "could only be called for blocks with 2 successors"' failed.16# Two tail calls in the same basic block after SCTC:17# CHECK: {{.*}}: ja {{.*}} # TAILCALL # Offset: 7 # CTCTakenCount: 418# CHECK-NEXT: {{.*}}: jmp {{.*}} # TAILCALL # Offset: 1319 20## Confirm that a deleted basic block is emitted at function end offset (0xe)21# CHECK-BAT: [[#%x,ADDR:]] g .text [[#%x,SIZE:]] _start22# CHECK-BAT: Function Address: 0x[[#%x,ADDR]]23# CHECK-BAT: 0x[[#%x,SIZE]]24# CHECK-BAT: NumBlocks: 525 26 .globl _start27_start:28 je x29a: ja b30 jmp c31x: ret32# FDATA: 1 _start #a# 1 _start #b# 2 433b: jmp e34c:35 .nops 136 jmp f37 38 .globl e39e:40 nop41 42 .globl f43f:44 nop45