Compiler projects using llvm
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noprobe.perfscript --binary=%S/Inputs/noprobe.perfbin --output=%t --skip-symbolization
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-RAW-PROFILE
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noprobe.mmap.perfscript --binary=%S/Inputs/noprobe.perfbin --output=%t --skip-symbolization
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-RAW-PROFILE
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noprobe.aggperfscript --binary=%S/Inputs/noprobe.perfbin --output=%t --skip-symbolization
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-RAW-PROFILE-AGG
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noprobe.perfscript --binary=%S/Inputs/noprobe.perfbin --output=%t
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK

;CHECK: foo:1241:0
;CHECK:  0: 0
;CHECK:  1: 0
;CHECK:  2: 19
;CHECK:  3: 21 bar:21
;CHECK:  4: 0
;CHECK:  5: 0
;CHECK: bar:926:21
;CHECK:  0: 20
;CHECK:  1: 20
;CHECK:  2: 13
;CHECK:  4: 6
;CHECK:  5: 18

CHECK-RAW-PROFILE:      7
CHECK-RAW-PROFILE-NEXT: 5b0-5c8:7
CHECK-RAW-PROFILE-NEXT: 5b0-5d7:13
CHECK-RAW-PROFILE-NEXT: 5dc-5e9:6
CHECK-RAW-PROFILE-NEXT: 5e5-5e9:12
CHECK-RAW-PROFILE-NEXT: 5ff-62f:19
CHECK-RAW-PROFILE-NEXT: 634-637:18
CHECK-RAW-PROFILE-NEXT: 645-645:18
CHECK-RAW-PROFILE-NEXT: 6
CHECK-RAW-PROFILE-NEXT: 5c8->5dc:7
CHECK-RAW-PROFILE-NEXT: 5d7->5e5:13
CHECK-RAW-PROFILE-NEXT: 5e9->634:18
CHECK-RAW-PROFILE-NEXT: 62f->5b0:21
CHECK-RAW-PROFILE-NEXT: 637->645:18
CHECK-RAW-PROFILE-NEXT: 645->5ff:19


CHECK-RAW-PROFILE-AGG:      7
CHECK-RAW-PROFILE-AGG-NEXT: 5b0-5c8:13
CHECK-RAW-PROFILE-AGG-NEXT: 5b0-5d7:21
CHECK-RAW-PROFILE-AGG-NEXT: 5dc-5e9:10
CHECK-RAW-PROFILE-AGG-NEXT: 5e5-5e9:20
CHECK-RAW-PROFILE-AGG-NEXT: 5ff-62f:31
CHECK-RAW-PROFILE-AGG-NEXT: 634-637:30
CHECK-RAW-PROFILE-AGG-NEXT: 645-645:30
CHECK-RAW-PROFILE-AGG-NEXT: 6
CHECK-RAW-PROFILE-AGG-NEXT: 5c8->5dc:13
CHECK-RAW-PROFILE-AGG-NEXT: 5d7->5e5:21
CHECK-RAW-PROFILE-AGG-NEXT: 5e9->634:30
CHECK-RAW-PROFILE-AGG-NEXT: 62f->5b0:35
CHECK-RAW-PROFILE-AGG-NEXT: 637->645:30
CHECK-RAW-PROFILE-AGG-NEXT: 645->5ff:31


; original code:
; clang -O3 -g -fdebug-info-for-profiling test.c -fno-inline -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;
}