Commit 0588e288 by Martin Liska Committed by Martin Liska

Calculate prediction remainder at proper place (PR tree-optimization/88650).

2019-01-02  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/88650
	* predict.c (set_even_probabilities): Calculate probability
	remainer only when really used.
2019-01-02  Martin Liska  <mliska@suse.cz>

	PR tree-optimization/88650
	* gfortran.dg/predict-3.f90: New test.

From-SVN: r267513
parent 17067056
2019-01-02 Martin Liska <mliska@suse.cz>
PR tree-optimization/88650
* predict.c (set_even_probabilities): Calculate probability
remainer only when really used.
2019-01-02 Richard Biener <rguenther@suse.de> 2019-01-02 Richard Biener <rguenther@suse.de>
PR middle-end/88651 PR middle-end/88651
......
...@@ -877,19 +877,21 @@ set_even_probabilities (basic_block bb, ...@@ -877,19 +877,21 @@ set_even_probabilities (basic_block bb,
int p = prediction->ep_probability; int p = prediction->ep_probability;
profile_probability prob profile_probability prob
= profile_probability::from_reg_br_prob_base (p); = profile_probability::from_reg_br_prob_base (p);
profile_probability remainder = prob.invert ();
remainder -= profile_probability::very_unlikely ()
.apply_scale (unlikely_count, 1);
int count = nedges - unlikely_count - 1;
gcc_assert (count >= 0);
profile_probability even = remainder.apply_scale (1, count);
if (prediction->ep_edge == e) if (prediction->ep_edge == e)
e->probability = prob; e->probability = prob;
else if (unlikely_edges != NULL && unlikely_edges->contains (e)) else if (unlikely_edges != NULL && unlikely_edges->contains (e))
e->probability = profile_probability::very_unlikely (); e->probability = profile_probability::very_unlikely ();
else else
e->probability = even; {
profile_probability remainder = prob.invert ();
remainder -= profile_probability::very_unlikely ()
.apply_scale (unlikely_count, 1);
int count = nedges - unlikely_count - 1;
gcc_assert (count >= 0);
e->probability = remainder.apply_scale (1, count);
}
} }
else else
e->probability = profile_probability::never (); e->probability = profile_probability::never ();
......
2019-01-02 Martin Liska <mliska@suse.cz>
PR tree-optimization/88650
* gfortran.dg/predict-3.f90: New test.
2019-01-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2019-01-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* g++.dg/gcov/pr88263.C: Rename namespace log to logging. * g++.dg/gcov/pr88263.C: Rename namespace log to logging.
......
! { dg-do compile }
! { dg-options "-fno-tree-fre -fno-tree-ccp -Og" }
program simplify_transfer
call pr30881 ()
contains
subroutine pr18769 ()
type t
end type t
end subroutine pr18769
subroutine pr30881 ()
INTEGER, PARAMETER :: K=1
I=TRANSFER(.TRUE.,K)
SELECT CASE(I)
CASE(TRANSFER(.TRUE.,K))
CASE(TRANSFER(.FALSE.,K))
STOP 2
CASE DEFAULT
STOP 3
END SELECT
END subroutine pr30881
subroutine pr31194 ()
end subroutine pr31194
subroutine pr31216 ()
END subroutine pr31216
subroutine pr31427 ()
END subroutine pr31427
end program simplify_transfer
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment