<commit_before>// Test that big branch weights get scaled down to 32-bits, rather than just
// truncated.

// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-counter-overflows.c %s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/c-counter-overflows.profdata | FileCheck %s

#include <stdint.h>

// PGOGEN: @[[MAIN:__llvm_pgo_ctr[0-9]*]] = private global [2 x i64] zeroinitializer
int main(int argc, const char *argv[]) {
  // Need counts higher than 32-bits.
  // CHECK: br {{.*}} !prof ![[FOR:[0-9]+]]
  // max   = 0xffffffff0
  // scale = 0xffffffff0 / 0xffffffff + 1 = 17
  // loop-body: 0xffffffff0 / 17 + 1 = 0xf0f0f0f0 + 1 = 4042322161 => -252645135
  // loop-exit: 0x000000001 / 17 + 1 = 0x00000000 + 1 =          1 =>          1
  for (uint64_t I = 0; I < 0xffffffff0; ++I) {
    // max   = 0xffffffff * 15 = 0xefffffff1
    // scale = 0xefffffff1 / 0xffffffff + 1 = 16
    // CHECK: br {{.*}} !prof ![[IF:[0-9]+]]<commit_msg>PGO: appease the bots after r203592<commit_after>// Test that big branch weights get scaled down to 32-bits, rather than just
// truncated.

// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-counter-overflows.c %s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/c-counter-overflows.profdata | FileCheck %s

typedef unsigned long long uint64_t;

// PGOGEN: @[[MAIN:__llvm_pgo_ctr[0-9]*]] = private global [2 x i64] zeroinitializer
int main(int argc, const char *argv[]) {
  // Need counts higher than 32-bits.
  // CHECK: br {{.*}} !prof ![[FOR:[0-9]+]]
  // max   = 0xffffffff0
  // scale = 0xffffffff0 / 0xffffffff + 1 = 17
  // loop-body: 0xffffffff0 / 17 + 1 = 0xf0f0f0f0 + 1 = 4042322161 => -252645135
  // loop-exit: 0x000000001 / 17 + 1 = 0x00000000 + 1 =          1 =>          1
  for (uint64_t I = 0; I < 0xffffffff0; ++I) {
    // max   = 0xffffffff * 15 = 0xefffffff1
    // scale = 0xefffffff1 / 0xffffffff + 1 = 16
    // CHECK: br {{.*}} !prof ![[IF:[0-9]+]]
{'fraction_non_alphanumeric': 0.16812790097988653, 'fraction_numerical': 0.1072717895822589, 'mean_word_length': 2.7451737451737452, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 22, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1766991', 'n_tokens_mistral': 910, 'n_tokens_neox': 733, 'n_words': 197}