|
| 1 | +## Test that infer-fall-throughs would correctly infer the wrong fall-through |
| 2 | +## edge count in the example |
| 3 | + |
| 4 | +# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o |
| 5 | +# RUN: link_fdata %s %t.o %t.fdata |
| 6 | +# RUN: llvm-strip --strip-unneeded %t.o |
| 7 | +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q |
| 8 | +# RUN: llvm-bolt %t.exe -o %t.bolt \ |
| 9 | +# RUN: --print-estimate-edge-counts --data=%t.fdata \ |
| 10 | +# RUN: 2>&1 | FileCheck --check-prefix=WITHOUTINFERENCE %s |
| 11 | +# RUN: llvm-bolt %t.exe -o %t.bolt --infer-fall-throughs \ |
| 12 | +# RUN: --print-estimate-edge-counts --data=%t.fdata \ |
| 13 | +# RUN: 2>&1 | FileCheck --check-prefix=CORRECTINFERENCE %s |
| 14 | + |
| 15 | + |
| 16 | +# WITHOUTINFERENCE: Binary Function "main" after estimate-edge-counts |
| 17 | +# WITHOUTINFERENCE: {{^\.Ltmp0}} |
| 18 | +# WITHOUTINFERENCE: Successors: .Ltmp1 (mispreds: 0, count: 10), .LFT0 (mispreds: 0, count: 0) |
| 19 | +# WITHOUTINFERENCE: {{^\.LFT0}} |
| 20 | +# WITHOUTINFERENCE: Exec Count : 490 |
| 21 | + |
| 22 | +# CORRECTINFERENCE: Binary Function "main" after estimate-edge-counts |
| 23 | +# CORRECTINFERENCE: {{^\.Ltmp0}} |
| 24 | +# CORRECTINFERENCE: Successors: .Ltmp1 (mispreds: 0, count: 10), .LFT0 (inferred count: 490) |
| 25 | +# CORRECTINFERENCE: {{^\.LFT0}} |
| 26 | +# CORRECTINFERENCE: Exec Count : 490 |
| 27 | + |
| 28 | + |
| 29 | + .globl main |
| 30 | + .type main, @function |
| 31 | +main: |
| 32 | +LLmain_LLstart: |
| 33 | + jmp LLstart |
| 34 | +# FDATA: 1 main #LLmain_LLstart# 1 main #LLstart# 0 500 |
| 35 | +LLstart: |
| 36 | + jge LLexit |
| 37 | +# FDATA: 1 main #LLstart# 1 main #LLexit# 0 10 |
| 38 | +# FDATA: 1 main #LLstart# 1 main #LLmore# 0 0 |
| 39 | +LLmore: |
| 40 | + movl $5, %eax |
| 41 | +# FDATA: 1 main #LLmore# 1 main #LLexit# 0 490 |
| 42 | +LLexit: |
| 43 | + ret |
| 44 | +.LLmain_end: |
| 45 | + .size main, .LLmain_end-main |
0 commit comments