| ; RUN: llvm-profgen --perfscript=%s --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --show-disassembly-only | FileCheck %s |
| |
| ; CHECK: <bar>: |
| ; CHECK-NEXT: 201750: pushq %rbp |
| ; CHECK-NEXT: 201751: movq %rsp, %rbp |
| ; CHECK-NEXT: 201754: imull $2863311531, %edi, %eax |
| ; CHECK-NEXT: 20175a: addl $715827882, %eax |
| ; CHECK-NEXT: 20175f: movl %esi, %ecx |
| ; CHECK-NEXT: 201761: negl %ecx |
| ; CHECK-NEXT: 201763: cmpl $1431655765, %eax |
| ; CHECK-NEXT: 201768: cmovbl %esi, %ecx |
| ; CHECK-NEXT: 20176b: leal (%rcx,%rdi), %eax |
| ; CHECK-NEXT: 20176e: popq %rbp |
| ; CHECK-NEXT: 20176f: retq |
| |
| ; CHECK: <foo>: |
| ; CHECK-NEXT 201770: movl $1, %ecx |
| ; CHECK-NEXT 201775: movl $2863311531, %r8d |
| ; CHECK-NEXT 20177b: jmp 0x78e |
| ; CHECK-NEXT 20177d: nopl (%rax) |
| ; CHECK-NEXT 201780: addl $30, %esi |
| ; CHECK-NEXT 201783: addl $1, %ecx |
| ; CHECK-NEXT 201786: cmpl $16000001, %ecx |
| |
| |
| ; clang -O3 -fexperimental-new-pass-manager -fuse-ld=lld -fpseudo-probe-for-profiling |
| ; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls |
| ; -g test.c -o a.out |
| |
| #include <stdio.h> |
| |
| int bar(int x, int y) { |
| if (x % 3) { |
| return x - y; |
| } |
| return x + y; |
| } |
| |
| void foo() { |
| int s, i = 0; |
| while (i++ < 4000 * 4000) |
| if (i % 91) s = bar(i, s); else s += 30; |
| printf("sum is %d\n", s); |
| } |
| |
| int main() { |
| foo(); |
| return 0; |
| } |