diff options
author | Jan Hubicka <jh@suse.cz> | 2020-08-10 08:18:13 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-08-10 08:18:13 +0200 |
commit | 527bf3bc8db6b6a1c075b0579deea156a55d49b6 (patch) | |
tree | 9a0ba41ad3e43ad9dc92ccab372e2edd1981445e /gcc/predict.c | |
parent | 5fb34b41a7979c8445ad5a28614a440458fd4285 (diff) | |
download | gcc-527bf3bc8db6b6a1c075b0579deea156a55d49b6.zip gcc-527bf3bc8db6b6a1c075b0579deea156a55d49b6.tar.gz gcc-527bf3bc8db6b6a1c075b0579deea156a55d49b6.tar.bz2 |
Fix remove_predictions_associated_with_edge
remove_predictions_associated_with_edge currently calls filter_predicitons
passing it equal_edge_p. Becase filter_predictions removes all edges where
filter returns false, the function does exact oposite. Fixed thus.
Bootstrapped/regtested x86_64-linux.
gcc/ChangeLog:
2020-08-02 Jan Hubicka <hubicka@ucw.cz>
* predict.c (filter_predictions): Document semantics of filter.
(equal_edge_p): Rename to ...
(not_equal_edge_p): ... this; reverse semantics.
(remove_predictions_associated_with_edge): Fix.
Diffstat (limited to 'gcc/predict.c')
-rw-r--r-- | gcc/predict.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/predict.c b/gcc/predict.c index 0a317a7..2164a06 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -595,10 +595,11 @@ gimple_predict_edge (edge e, enum br_predictor predictor, int probability) } } -/* Filter edge predictions PREDS by a function FILTER. DATA are passed - to the filter function. */ +/* Filter edge predictions PREDS by a function FILTER: if FILTER return false + the prediction is removed. + DATA are passed to the filter function. */ -void +static void filter_predictions (edge_prediction **preds, bool (*filter) (edge_prediction *, void *), void *data) { @@ -627,10 +628,10 @@ filter_predictions (edge_prediction **preds, /* Filter function predicate that returns true for a edge predicate P if its edge is equal to DATA. */ -bool -equal_edge_p (edge_prediction *p, void *data) +static bool +not_equal_edge_p (edge_prediction *p, void *data) { - return p->ep_edge == (edge)data; + return p->ep_edge != (edge)data; } /* Remove all predictions on given basic block that are attached @@ -642,7 +643,7 @@ remove_predictions_associated_with_edge (edge e) return; edge_prediction **preds = bb_predictions->get (e->src); - filter_predictions (preds, equal_edge_p, e); + filter_predictions (preds, not_equal_edge_p, e); } /* Clears the list of predictions stored for BB. */ |