diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-14 19:06:10 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-14 19:06:10 +0000 |
commit | 4701372e3d1286672e54afa327a434ee9034edf0 (patch) | |
tree | 8e5403c396a8dbd4755b716da39cbfb2ce9cd734 /gcc/cfg.c | |
parent | e746f64d341e6bd4deea2945288106684d38265d (diff) | |
download | gcc-4701372e3d1286672e54afa327a434ee9034edf0.tar.gz |
PR tree-optimization/34046
* cfg.c (update_bb_profile_for_threading): Avoid the division for the
scaling if the old probability is greater than the new base.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130185 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfg.c')
-rw-r--r-- | gcc/cfg.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cfg.c b/gcc/cfg.c index 40e51a52041..0b0e9503b2b 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -990,9 +990,15 @@ update_bb_profile_for_threading (basic_block bb, int edge_frequency, FOR_EACH_EDGE (c, ei, bb->succs) { - c->probability = RDIV (c->probability * scale, 65536); - if (c->probability > REG_BR_PROB_BASE) + /* Protect from overflow due to additional scaling. */ + if (c->probability > prob) c->probability = REG_BR_PROB_BASE; + else + { + c->probability = RDIV (c->probability * scale, 65536); + if (c->probability > REG_BR_PROB_BASE) + c->probability = REG_BR_PROB_BASE; + } } } |