Do not combine PRED_LOOP_GUARD and PRED_LOOP_GUARD_WITH_RECURSION
authorJan Hubicka <jh@suse.cz>
Tue, 11 Aug 2020 10:02:32 +0000 (12:02 +0200)
committerJan Hubicka <jh@suse.cz>
Tue, 11 Aug 2020 10:02:32 +0000 (12:02 +0200)
commit1118a3ff9d3ad6a64bba25dc01e7703325e23d92
treeffaecdfa7a38197b140ad70bf9274fe2f4c0c67a
parent6c2583c14a8776e88f9834608686f34ec11f717f
Do not combine PRED_LOOP_GUARD and PRED_LOOP_GUARD_WITH_RECURSION

This patch avoids both PRED_LOOP_GUARD and PRED_LOOP_GUARD_WITH_RECURSION to be
attached to one edge.  We have logic that prevents same predictor to apply to
one edge twice, but since we split LOOP_GUARD to two more specialized cases,
this no longer fires.

Double prediction happens in exchange benchmark and leads to unrealistically
low hitrates on some edges which in turn leads to bad IPA profile and misguides
ipa-cp.

Unforutnately it seems that the bad profile also leads to bit better
performance by disabling some of loop stuff, but that really ought to be done
in some meaningful way, not by an accident.

gcc/ChangeLog:

2020-08-11  Jan Hubicka  <hubicka@ucw.cz>

* predict.c (not_loop_guard_equal_edge_p): New function.
(maybe_predict_edge): New function.
(predict_paths_for_bb): Use it.
(predict_paths_leading_to_edge): Use it.

gcc/testsuite/ChangeLog:

2020-08-11  Jan Hubicka  <hubicka@ucw.cz>

* gcc.dg/ipa/ipa-clone-2.c: Lower threshold from 500 to 400.
gcc/predict.c
gcc/testsuite/gcc.dg/ipa/ipa-clone-2.c