aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-06-17 12:34:49 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-06-17 12:34:49 +0000
commit866f20d64073a67d2e78c212b42b4bc8ceff1dba (patch)
tree7072bbde82d7eced1858a887f39501322d76483b /gcc/tree-switch-conversion.c
parent00bdef2c7f08053ec20d8d8e57959209eb8d54fe (diff)
downloadgcc-866f20d64073a67d2e78c212b42b4bc8ceff1dba.zip
gcc-866f20d64073a67d2e78c212b42b4bc8ceff1dba.tar.gz
gcc-866f20d64073a67d2e78c212b42b4bc8ceff1dba.tar.bz2
tree-switch-conversion.c (collect_switch_conv_info): Simplify and allow all blocks to be forwarders.
2014-06-17 Richard Biener <rguenther@suse.de> * tree-switch-conversion.c (collect_switch_conv_info): Simplify and allow all blocks to be forwarders. From-SVN: r211735
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r--gcc/tree-switch-conversion.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 9789b61..f6e3eb3 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -640,15 +640,16 @@ collect_switch_conv_info (gimple swtch, struct switch_conv_info *info)
info->other_count += e->count;
/* See if there is one common successor block for all branch
- targets. If it exists, record it in FINAL_BB. */
- FOR_EACH_EDGE (e, ei, info->switch_bb->succs)
- {
- if (! single_pred_p (e->dest))
- {
- info->final_bb = e->dest;
- break;
- }
- }
+ targets. If it exists, record it in FINAL_BB.
+ Start with the destination of the default case as guess
+ or its destination in case it is a forwarder block. */
+ if (! single_pred_p (e_default->dest))
+ info->final_bb = e_default->dest;
+ else if (single_succ_p (e_default->dest)
+ && ! single_pred_p (single_succ (e_default->dest)))
+ info->final_bb = single_succ (e_default->dest);
+ /* Require that all switch destinations are either that common
+ FINAL_BB or a forwarder to it. */
if (info->final_bb)
FOR_EACH_EDGE (e, ei, info->switch_bb->succs)
{