Test llvm-profdata merge with function filters.
RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --function="_Z3.*" | FileCheck %s --check-prefix=CHECK-FILTER1
RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --no-function="main" | FileCheck %s --check-prefix=CHECK-FILTER1
CHECK-FILTER1: _Z3bari:20301:1437
CHECK-NEXT: 1: 1437
CHECK-NEXT: _Z3fooi:7711:610
CHECK-NEXT: 1: 610
CHECK-NOT: main
RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --function="_Z3.*" --no-function="fooi$" | FileCheck %s --check-prefix=CHECK-FILTER2
CHECK-FILTER2: _Z3bari:20301:1437
CHECK-NEXT: 1: 1437
CHECK-NOT: main
CHECK-NOT: _Z3fooi
RUN: llvm-profdata merge --sample --extbinary --use-md5 -output=%t.0.profdata %p/Inputs/sample-profile.proftext
RUN: llvm-profdata merge --sample %t.0.profdata --text --function="_Z3fooi" | FileCheck %s --check-prefix=CHECK-FILTER-MD5
CHECK-FILTER-MD5: 1228452328526475178:7711:610
CHECK-NEXT: 1: 610
CHECK-NOT: 15822663052811949562
CHECK-NOT: 3727899762981752933
RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --function="foo" | FileCheck %s --check-prefix=CHECK-FILTER3
RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --no-function="main" | FileCheck %s --check-prefix=CHECK-FILTER3
CHECK-FILTER3: foo
CHECK-NEXT: # Func Hash:
CHECK-NEXT: 10
CHECK-NEXT: # Num Counters:
CHECK-NEXT: 2
CHECK-NEXT: # Counter Values:
CHECK-NEXT: 499500
CHECK-NEXT: 179900
CHECK-NEXT:
CHECK-NEXT: foo2
CHECK-NEXT: # Func Hash:
CHECK-NEXT: 10
CHECK-NEXT: # Num Counters:
CHECK-NEXT: 2
CHECK-NEXT: # Counter Values:
CHECK-NEXT: 500500
CHECK-NEXT: 180100
RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --function="foo" --no-function="^foo$" | FileCheck %s --check-prefix=CHECK-FILTER4
CHECK-FILTER4: foo2
CHECK-NEXT: # Func Hash:
CHECK-NEXT: 10
CHECK-NEXT: # Num Counters:
CHECK-NEXT: 2
CHECK-NEXT: # Counter Values:
CHECK-NEXT: 500500
CHECK-NEXT: 180100
RUN: llvm-profdata merge --sample %p/Inputs/cs-sample.proftext --text --function="main.*@.*_Z5funcBi" | FileCheck %s --check-prefix=CHECK-FILTER5
CHECK-FILTER5: [main:3.1 @ _Z5funcBi:1 @ _Z8funcLeafi]:500853:20
CHECK-NEXT: 0: 15
CHECK-NEXT: 1: 15
CHECK-NEXT: 3: 74946
CHECK-NEXT: 4: 74941 _Z3fibi:82359
CHECK-NEXT: 10: 23324
CHECK-NEXT: 11: 23327 _Z3fibi:25228
CHECK-NEXT: 15: 11
CHECK-NEXT: !Attributes: 1
CHECK-NEXT: [main:3.1 @ _Z5funcBi]:120:19
CHECK-NEXT: 0: 19
CHECK-NEXT: 1: 19 _Z8funcLeafi:20
CHECK-NEXT: 3: 12
CHECK-NEXT: !Attributes: 1