diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-07-20 11:27:31 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-07-20 11:27:31 +0000 |
commit | 2438e5540a34d5302a372485f5f1c8ffa0b02e44 (patch) | |
tree | dca9635e1c7a90ba3710ab30b39797c71afd824e /gcc/cfgbuild.c | |
parent | 6154acba935366d232c0873afdc5af50f525183c (diff) | |
download | gcc-2438e5540a34d5302a372485f5f1c8ffa0b02e44.tar.gz |
PR middle-end/81030
* cfgbuild.c (find_many_sub_basic_blocks): Update REG_BR_PROB note
when gimple level profile disagrees with what RTL expander did.
* gcc.dg/pr81030.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250383 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgbuild.c')
-rw-r--r-- | gcc/cfgbuild.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index 16b07073b91..2fe74c40851 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -673,10 +673,18 @@ find_many_sub_basic_blocks (sbitmap blocks) && profile_status_for_fn (cfun) != PROFILE_READ)) bb->count = profile_count::uninitialized (); } - else - /* If nothing changed, there is no need to create new BBs. */ - if (EDGE_COUNT (bb->succs) == n_succs[bb->index]) + /* If nothing changed, there is no need to create new BBs. */ + else if (EDGE_COUNT (bb->succs) == n_succs[bb->index]) + { + /* In rare occassions RTL expansion might have mistakely assigned + a probabilities different from what is in CFG. This happens + when we try to split branch to two but optimize out the + second branch during the way. See PR81030. */ + if (JUMP_P (BB_END (bb)) && any_condjump_p (BB_END (bb)) + && EDGE_COUNT (bb->succs) >= 2) + update_br_prob_note (bb); continue; + } compute_outgoing_frequencies (bb); } |