]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-switch-conversion.c (collect_switch_conv_info): Simplify and allow all blocks...
authorRichard Biener <rguenther@suse.de>
Tue, 17 Jun 2014 12:34:49 +0000 (12:34 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 17 Jun 2014 12:34:49 +0000 (12:34 +0000)
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

gcc/ChangeLog
gcc/tree-switch-conversion.c

index 08353945c20b41125d098cf1463fec6e7ec3dfb9..e42464f9731a5f521611710d1dfe878dc7c9905e 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-17  Richard Biener  <rguenther@suse.de>
+
+       * tree-switch-conversion.c (collect_switch_conv_info): Simplify
+       and allow all blocks to be forwarders.
+
 2014-06-17  Yufeng Zhang  <yufeng.zhang@arm.com>
 
        PR target/61483
index 9789b619ee24690718754065fb920ec40349b8bc..f6e3eb3ebd2bc5d701ee6ded9833318c81ce06e0 100644 (file)
@@ -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)
       {