> __attribute__((noipa)) void > bar (void) > { > __builtin_exit (0); > } > > __attribute__((noipa)) void > foo (void) > { > for (int i = 0; i < 1000; ++i) > for (int j = 0; j < 1000; ++j) > for (int k = 0; k < 1000; ++k) > for (int l = 0; l < 1000; ++l) > for (int m = 0; m < 1000; ++m) > for (int n = 0; n < 1000; ++n) > for (int o = 0; o < 1000; ++o) > for (int p = 0; p < 1000; ++p) > for (int q = 0; q < 1000; ++q) > for (int r = 0; r < 1000; ++r) > for (int s = 0; s < 1000; ++s) > for (int t = 0; t < 1000; ++t) > for (int u = 0; u < 1000; ++u) > for (int v = 0; v < 1000; ++v) > for (int w = 0; w < 1000; ++w) > for (int x = 0; x < 1000; ++x) > for (int y = 0; y < 1000; ++y) > for (int z = 0; z < 1000; ++z) > for (int a = 0; a < 1000; ++a) > for (int b = 0; b < 1000; ++b) > bar (); > } > > int > main () > { > foo (); > } > reaches the maximum count already on the 11th loop.
This should not happen - this is a reason why we esimate in sreals and convert to profile_counts only later. In this case we should push down the profile_count of entry block (to 0) freq_max = 0; FOR_EACH_BB_FN (bb, cfun) if (freq_max < BLOCK_INFO (bb)->frequency) freq_max = BLOCK_INFO (bb)->frequency; /* Scaling frequencies up to maximal profile count may result in frequent overflows especially when inlining loops. Small scalling results in unnecesary precision loss. Stay in the half of the (exponential) range. */ freq_max = (sreal (1) << (profile_count::n_bits / 2)) / freq_max; if (freq_max < 16) freq_max = 16; I am looking on what goes wrong here. Honza