brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 4ca43bc Raw
70 lines · plain
1; In the perfscript input, the consecutive branch pairs 0x2017bf/0x201760 and 0x2017d8/0x2017e3 form an invalid execution range [0x2017e3, 0x2017bf].2; We are testing only the invalid range is dropped to avoid bogus instruction ranges. All other ranges and all branch samples should be kept.3;4; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/invalid-range.perfscript --binary=%S/Inputs/noinline-cs-pseudoprobe.perfbin --output=%t1 --skip-symbolization --ignore-stack-samples --use-offset=05; RUN: FileCheck %s --input-file %t1 --check-prefix=NOCS6 7; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/invalid-range.perfscript --binary=%S/Inputs/noinline-cs-pseudoprobe.perfbin --output=%t2 --skip-symbolization --use-offset=08; RUN: FileCheck %s --input-file %t2 --check-prefix=CS9 10 11; NOCS: 412; NOCS-NEXT: 201760-20177f:713; NOCS-NEXT: 20179e-2017bf:514; NOCS-NEXT: 2017c4-2017cf:615; NOCS-NEXT: 2017c4-2017d8:116; NOCS-NEXT: 417; NOCS-NEXT: 20177f->2017c4:718; NOCS-NEXT: 2017bf->201760:719; NOCS-NEXT: 2017cf->20179e:820; NOCS-NEXT: 2017d8->2017e3:121 22 23; CS:      []24; CS-NEXT:   425; CS-NEXT:   201760-20177f:626; CS-NEXT:   20179e-2017bf:527; CS-NEXT:   2017c4-2017cf:528; CS-NEXT:   2017c4-2017d8:129; CS-NEXT:   430; CS-NEXT:   20177f->2017c4:631; CS-NEXT:   2017bf->201760:632; CS-NEXT:   2017cf->20179e:633; CS-NEXT:   2017d8->2017e3:134; CS-NEXT: [0x2017f4]35; CS-NEXT:   136; CS-NEXT:   2017c4-2017cf:137; CS-NEXT:   238; CS-NEXT:   2017bf->201760:139; CS-NEXT:   2017cf->20179e:240; CS-NEXT: [0x2017f4 @ 0x2017bf]41; CS-NEXT:   142; CS-NEXT:   201760-20177f:143; CS-NEXT:   144; CS-NEXT:   20177f->2017c4:145 46; clang -O3 -fuse-ld=lld -fpseudo-probe-for-profiling47; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls48; -g test.c  -o a.out49 50#include <stdio.h>51 52int bar(int x, int y) {53  if (x % 3) {54    return x - y;55  }56  return x + y;57}58 59void foo() {60  int s, i = 0;61  while (i++ < 4000 * 4000)62    if (i % 91) s = bar(i, s); else s += 30;63  printf("sum is %d\n", s);64}65 66int main() {67  foo();68  return 0;69}70