diff options
author | revitale <revitale@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-17 17:49:32 +0000 |
---|---|---|
committer | revitale <revitale@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-17 17:49:32 +0000 |
commit | fa7f4c0c52358844b85cecae446b27c11493fe0a (patch) | |
tree | 19b4e65ff60f74bee91f1896d5f9aeafbe206c91 /gcc/loop-doloop.c | |
parent | 74748e47c7c3af646d70012caeff51f5531d60cd (diff) | |
download | gcc-fa7f4c0c52358844b85cecae446b27c11493fe0a.tar.gz |
Fix 34826
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131604 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-doloop.c')
-rw-r--r-- | gcc/loop-doloop.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c index 6e33a4f9ba0..448bb723a55 100644 --- a/gcc/loop-doloop.c +++ b/gcc/loop-doloop.c @@ -348,6 +348,7 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, bool increment_count; basic_block loop_end = desc->out_edge->src; enum machine_mode mode; + rtx true_prob_val; jump_insn = BB_END (loop_end); @@ -361,6 +362,10 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, fputs (" iterations).\n", dump_file); } + /* Get the probabilty of the original branch. If it exists we would + need to update REG_BR_PROB of the new jump_insn. */ + true_prob_val = find_reg_note (jump_insn, REG_BR_PROB, NULL_RTX); + /* Discard original jump to continue loop. The original compare result may still be live, so it cannot be discarded explicitly. */ delete_insn (jump_insn); @@ -516,6 +521,15 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, REG_NOTES (jump_insn) = gen_rtx_EXPR_LIST (REG_NONNEG, NULL_RTX, REG_NOTES (jump_insn)); } + /* Update the REG_BR_PROB note. */ + if (true_prob_val) + { + /* Seems safer to use the branch probability. */ + REG_NOTES (jump_insn) = + gen_rtx_EXPR_LIST (REG_BR_PROB, + GEN_INT (desc->in_edge->probability), + REG_NOTES (jump_insn)); + } } /* Process loop described by LOOP validating that the loop is suitable for |