| # Check that --print-mem-data option works properly in llvm-bolt |
| |
| # RUN: split-file %s %t |
| # RUN: %clang %cflags -fPIC -pie %t/main.s -o %t.exe -nostdlib -Wl,-q |
| # RUN: llvm-bolt %t.exe -o %t.bolt --print-mem-data=true --print-cfg \ |
| # RUN: --data %t/fdata | FileCheck %s -check-prefix=CHECK-PRINT |
| # RUN: llvm-bolt %t.exe -o %t.bolt --print-cfg \ |
| # RUN: --data %t/fdata | FileCheck %s -check-prefix=CHECK-DEFAULT |
| |
| # CHECK-PRINT: ldr w2, [x1], #0x4 # MemoryAccessProfile: 7 total counts : |
| # CHECK-PRINT-NEXT: { 0x123: 1 }, |
| # CHECK-PRINT-NEXT: { 0x456: 2 }, |
| # CHECK-PRINT-NEXT: { 0xabc: 4 } |
| # CHECK-DEFAULT-NOT: MemoryAccessProfile |
| |
| #--- main.s |
| .text |
| .align 4 |
| .global main |
| .type main, %function |
| main: |
| sub sp, sp, #48 |
| add x1, sp, 8 |
| add x3, sp, 48 |
| mov w0, 0 |
| .L2: |
| ldr w2, [x1], 4 |
| add w0, w0, w2 |
| cmp x1, x3 |
| bne .L2 |
| add sp, sp, 48 |
| ret |
| .size main, .-main |
| |
| # The three memory access data generated by the load at |
| # offset 0x10 in the main. |
| #--- fdata |
| 4 main 10 4 otherSym 123 1 |
| 4 main 10 4 otherSym 456 2 |
| 4 main 10 4 otherSym abc 4 |