This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Blackfin: delete empty doloops
- From: Bernd Schmidt <bernds_cb1 at t-online dot de>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 16 May 2008 13:04:30 +0200
- Subject: Blackfin: delete empty doloops
This adds a small piece of code to the Blackfin-specific doloop reorg
pass, which allows us to detect and delete empty loops. This makes
dhrystone go faster, so clearly it's very important.
Committed as 135414.
Bernd
--
This footer brought to you by insane German lawmakers.
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif
Index: ChangeLog
===================================================================
--- ChangeLog (revision 135413)
+++ ChangeLog (working copy)
@@ -1,5 +1,7 @@
2008-05-16 Bernd Schmidt <bernd.schmidt@analog.com>
+ * config/bfin/bfin.c (bfin_discover_loops): Delete empty loops.
+
From Jie Zhang <jie.zhang@analog.com>
* config/bfin/t-bfin-elf (MULTILIB_OPTIONS, MULTILIB_DIRNAMES,
MULTILIB_MATCHES, MULTILIB_EXCEPTIONS): Remove mcpu=bf532-0.3,
Index: config/bfin/bfin.c
===================================================================
--- config/bfin/bfin.c (revision 135413)
+++ config/bfin/bfin.c (working copy)
@@ -4218,8 +4218,23 @@ bfin_discover_loops (bitmap_obstack *sta
if (INSN_P (tail) && recog_memoized (tail) == CODE_FOR_loop_end)
{
+ rtx insn;
/* A possible loop end */
+ /* There's a degenerate case we can handle - an empty loop consisting
+ of only a back branch. Handle that by deleting the branch. */
+ insn = BB_HEAD (BRANCH_EDGE (bb)->dest);
+ if (next_real_insn (insn) == tail)
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, ";; degenerate loop ending at\n");
+ print_rtl_single (dump_file, tail);
+ }
+ delete_insn_and_edges (tail);
+ continue;
+ }
+
loop = XNEW (struct loop_info);
loop->next = loops;
loops = loop;