[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-20 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |8.0

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-21 Thread seurer at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

seurer at gcc dot gnu.org changed:

   What|Removed |Added

 CC||seurer at gcc dot gnu.org

--- Comment #1 from seurer at gcc dot gnu.org ---
Also saw this on powerpc64

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-22 Thread seurer at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #2 from seurer at gcc dot gnu.org ---
The specific revision this starts failing with is 254888.

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-22 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-11-22
 Ever confirmed|0   |1

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-22 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #3 from H.J. Lu  ---
(In reply to seurer from comment #2)
> The specific revision this starts failing with is 254888.

This is r254888.

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-23 Thread siddhesh at gotplt dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #4 from Siddhesh Poyarekar  ---
Reduced C test case:

#define MAX 98

void foo (unsigned long *res, unsigned long in)
{
  for (unsigned long a = 0; a < MAX; a++)
for (unsigned long b = 0; b < MAX; b++)
  for (unsigned long c = 0; c < MAX; c++)
for (unsigned long d = 0; d < MAX; d++)
  for (unsigned long e = 0; e < MAX; e++)
for (unsigned long f = 0; f < MAX; f++)
  for (unsigned long g = 0; g < MAX; g++)
*res += a * in;
}



foo.c: In function 'foo':
foo.c:13:1: internal compiler error: in from_gcov_type, at profile-count.h:676
 }
 ^
0xaaf57f profile_count::from_gcov_type(long)
/home/siddhesh/src/gcc/gcc/profile-count.h:676
0xaaf57f estimate_bb_frequencies(bool)
/home/siddhesh/src/gcc/gcc/predict.c:3623
0xab40af tree_estimate_probability(bool)
/home/siddhesh/src/gcc/gcc/predict.c:2849
0xab45c3 execute
/home/siddhesh/src/gcc/gcc/predict.c:3760
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-23 Thread siddhesh at gotplt dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #5 from Siddhesh Poyarekar  ---
This fixes the problem for me.  freq_max < 1, i.e. freq_max of one of the bbs
in the function means that it ends up having a profile count larger than 2^30
since the freq_max gets reset to 16.  Dropping this reset makes sure that the
profile counts are always correctly normalized to real_bb_freq_max:

diff --git a/gcc/predict.c b/gcc/predict.c
index 0f34956..ff9b5a9 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3613,8 +3613,6 @@ estimate_bb_frequencies (bool force)
  freq_max = BLOCK_INFO (bb)->frequency;

   freq_max = real_bb_freq_max / freq_max;
-  if (freq_max < 16)
-   freq_max = 16;
   profile_count ipa_count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count.ipa ();
   cfun->cfg->count_max = profile_count::uninitialized ();
   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-23 Thread siddhesh at gotplt dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #6 from Siddhesh Poyarekar  ---
(In reply to Siddhesh Poyarekar from comment #5)
> This fixes the problem for me.  freq_max < 1, i.e. freq_max of one of the
> bbs in the function means that it ends up having a profile count larger than

Sorry, that bit should read as "freq_max < 1, i.e. highest frequency among bbs
in the function being higher than real_bb_freq_max means that the bb ends up
with a profile count larger than real_bb_freq_max and then can go all the way
up to and beyond profile_count::max_count".

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-27 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

David Binderman  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #7 from David Binderman  ---
(In reply to Siddhesh Poyarekar from comment #5)
> This fixes the problem for me.

Maybe some more extensive testing of your patch would increase 
the chances of it being accepted.

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-27 Thread andrey.y.guskov at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

Andrey Guskov  changed:

   What|Removed |Added

 CC||andrey.y.guskov at intel dot 
com

--- Comment #8 from Andrey Guskov  ---
Also happens on Haswell and Silvermont.

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-27 Thread sudi.das at arm dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

Sudakshina Das  changed:

   What|Removed |Added

 CC||sudi.das at arm dot com

--- Comment #9 from Sudakshina Das  ---
Confirmed on aarch64-none-linux-gnu

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-27 Thread skpgkp1 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

Sunil Pandey  changed:

   What|Removed |Added

 CC||skpgkp1 at gmail dot com

--- Comment #10 from Sunil Pandey  ---
Seems like I hit the same bug while compiling mariadb with GCC8.

$cat CMap.i.cc
void a() {
  int b = 0;
  for (; b < 256; ++b)
a();
}

$g++ --version
g++ (GCC) 8.0.0 20171127 (experimental)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$g++ -O3  -o CMap.i.cc.o -c CMap.i.cc
during IPA pass: inline
CMap.i.cc: In function ‘void a()’:
CMap.i.cc:1:6: internal compiler error: in from_gcov_type, at
profile-count.h:676
 void a() {
  ^
0x712c42 estimate_bb_frequencies(bool)
../../gcc-main.3O1J/gcc/profile-count.h:676
0xe73137 rebuild_frequencies()
../../gcc-main.3O1J/gcc/predict.c:3911
0xe59904 execute_function_todo
../../gcc-main.3O1J/gcc/passes.c:1975
0xe5a28e execute_todo
../../gcc-main.3O1J/gcc/passes.c:2048
0x70fc43 execute_one_ipa_transform_pass
../../gcc-main.3O1J/gcc/passes.c:2245
0x70fc43 execute_all_ipa_transforms()
../../gcc-main.3O1J/gcc/passes.c:2281
0xba1a8a cgraph_node::expand()
../../gcc-main.3O1J/gcc/cgraphunit.c:2132
0xba2cab expand_all_functions
../../gcc-main.3O1J/gcc/cgraphunit.c:2275
0xba2cab symbol_table::compile()
../../gcc-main.3O1J/gcc/cgraphunit.c:2623
0xba4fc9 symbol_table::compile()
../../gcc-main.3O1J/gcc/cgraphunit.c:2537
0xba4fc9 symbol_table::finalize_compilation_unit()
../../gcc-main.3O1J/gcc/cgraphunit.c:2716
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-28 Thread rdapp at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

rdapp at linux dot vnet.ibm.com changed:

   What|Removed |Added

 CC||rdapp at linux dot vnet.ibm.com

--- Comment #11 from rdapp at linux dot vnet.ibm.com ---
416.gamess fails on S390 as well since r254888.

I didn't immediately get what the

  if (freq_max < 16)
freq_max = 16;

part of the patch is supposed to achieve. When freq_max < 16, tmp will later be
larger than BLOCK_INFO (bb)->frequency which wasn't the case before. In the
worst case we approach max_count by 4 bits every time.
Why do we need a minimum freq_max? To ensure some scaling even for low
frequencies?

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-28 Thread siddhesh at gotplt dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #12 from Siddhesh Poyarekar  ---
(In reply to rdapp from comment #11)
> 416.gamess fails on S390 as well since r254888.
> 
> I didn't immediately get what the
> 
>   if (freq_max < 16)
>   freq_max = 16;
> 
> part of the patch is supposed to achieve. When freq_max < 16, tmp will later
> be larger than BLOCK_INFO (bb)->frequency which wasn't the case before. In
> the worst case we approach max_count by 4 bits every time.
> Why do we need a minimum freq_max? To ensure some scaling even for low
> frequencies?

I suppose the minimum frequency is to prevent loss of precision in the lower
frequencies (they may get rounded off to 0 in the profile counts since they're
integers) when the max_freq is greater than max_real_bb_freq.  It is consistent
with earlier behaviour and the higher max_real_bb_freq should give us a net win
anyway.

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-28 Thread siddhesh at gotplt dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #13 from Siddhesh Poyarekar  ---
(In reply to David Binderman from comment #7)
> Maybe some more extensive testing of your patch would increase 
> the chances of it being accepted.

make check just finished on aarch64 and saw no failures due to this patch. 
make check on aarch64 is almost on its last legs and shows now new failures
either.

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-28 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

--- Comment #14 from Jan Hubicka  ---
Letting entry block frequency to drop to 0 has bad effect on IPA profile
propagation.  Since new profile count arithmetics is overflow safe, I think we
should just cap it to max_count in such case.

The loop as written will never finish anyway so and if the bounds are not known
we should teach branch prediction to work out that it is not a good idea to
estimate very deep loop nests with "large" trip count.

I will prepare patch that silence the assert.

Honza

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-11-30 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #15 from Markus Trippelsdorf  ---
*** Bug 83229 has been marked as a duplicate of this bug. ***

[Bug middle-end/83069] [8 Regression] internal compiler error: in from_gcov_type, at profile-count.h:676

2017-12-10 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83069

Jan Hubicka  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #16 from Jan Hubicka  ---
I made typo in PR number, but it is fixed by
2017-12-08  Jan Hubicka  

PR middle-end/83609
* profile-count.c (profile_count::from_gcov_type): Move from
profile-count.h; handle overflow.
* profile-count.h (profile_count::from_gcov_type): Move offline.