From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: rguenther@suse.de (Richard Guenther)
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [rfc] Fix SPU build (Re: [PATCH] Remove basic_block->loop_depth)
Date: Wed, 15 Aug 2012 22:18:00 -0000 [thread overview]
Message-ID: <201208152217.q7FMHjJT006657@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1208151404390.28649@zhemvz.fhfr.qr> from "Richard Guenther" at Aug 15, 2012 02:05:14 PM
Richard Guenther wrote:
> On Wed, 15 Aug 2012, Ulrich Weigand wrote:
> > It seems flow_loops_find by itself is not quite enough, but everything
> > necessary to use the loop structures seems to be encapsulated in
> > loop_optimizer_init / loop_optimizer_finalize, which are already called
> > by a number of optimization passes. When I do the same in the SPU
> > md-reorg pass, loop_father seems to be set up OK.
> >
> > Does this look reasonable?
>
> Yes. You can use bb_loop_depth instead of loop_depth (bb->loop_father).
Ah, good point. Below the version I committed. Tested on spu-elf.
Thanks,
Ulrich
ChangeLog:
* config/spu/spu.c: Include "cfgloop.h".
(spu_machine_dependent_reorg): Call loop_optimizer_init and
loop_optimizer_finalize. Use bb_loop_depth instead of loop_depth.
Directly compare loop_father values where appropriate.
* config/spu/t-spu-elf (spu.o): Update dependencies.
Index: gcc/config/spu/spu.c
===================================================================
*** gcc/config/spu/spu.c (revision 190390)
--- gcc/config/spu/spu.c (working copy)
***************
*** 53,58 ****
--- 53,59 ----
#include "timevar.h"
#include "df.h"
#include "dumpfile.h"
+ #include "cfgloop.h"
/* Builtin types, data and prototypes. */
*************** spu_machine_dependent_reorg (void)
*** 2458,2463 ****
--- 2459,2468 ----
in_spu_reorg = 1;
compute_bb_for_insn ();
+ /* (Re-)discover loops so that bb->loop_father can be used
+ in the analysis below. */
+ loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
+
compact_blocks ();
spu_bb_info =
*************** spu_machine_dependent_reorg (void)
*** 2562,2575 ****
fallthru block. This catches the cases when it is a simple
loop or when there is an initial branch into the loop. */
if (prev && (loop_exit || simple_loop)
! && prev->loop_depth <= bb->loop_depth)
prop = prev;
/* If there is only one adjacent predecessor. Don't propagate
! outside this loop. This loop_depth test isn't perfect, but
! I'm not sure the loop_father member is valid at this point. */
else if (prev && single_pred_p (bb)
! && prev->loop_depth == bb->loop_depth)
prop = prev;
/* If this is the JOIN block of a simple IF-THEN then
--- 2567,2579 ----
fallthru block. This catches the cases when it is a simple
loop or when there is an initial branch into the loop. */
if (prev && (loop_exit || simple_loop)
! && bb_loop_depth (prev) <= bb_loop_depth (bb))
prop = prev;
/* If there is only one adjacent predecessor. Don't propagate
! outside this loop. */
else if (prev && single_pred_p (bb)
! && prev->loop_father == bb->loop_father)
prop = prev;
/* If this is the JOIN block of a simple IF-THEN then
*************** spu_machine_dependent_reorg (void)
*** 2578,2584 ****
&& EDGE_COUNT (bb->preds) == 2
&& EDGE_COUNT (prev->preds) == 1
&& EDGE_PRED (prev, 0)->src == prev2
! && prev2->loop_depth == bb->loop_depth
&& GET_CODE (branch_target) != REG)
prop = prev;
--- 2582,2588 ----
&& EDGE_COUNT (bb->preds) == 2
&& EDGE_COUNT (prev->preds) == 1
&& EDGE_PRED (prev, 0)->src == prev2
! && prev2->loop_father == bb->loop_father
&& GET_CODE (branch_target) != REG)
prop = prev;
*************** spu_machine_dependent_reorg (void)
*** 2600,2606 ****
if (dump_file)
fprintf (dump_file, "propagate from %i to %i (loop depth %i) "
"for %i (loop_exit %i simple_loop %i dist %i)\n",
! bb->index, prop->index, bb->loop_depth,
INSN_UID (branch), loop_exit, simple_loop,
branch_addr - INSN_ADDRESSES (INSN_UID (bbend)));
--- 2604,2610 ----
if (dump_file)
fprintf (dump_file, "propagate from %i to %i (loop depth %i) "
"for %i (loop_exit %i simple_loop %i dist %i)\n",
! bb->index, prop->index, bb_loop_depth (bb),
INSN_UID (branch), loop_exit, simple_loop,
branch_addr - INSN_ADDRESSES (INSN_UID (bbend)));
*************** spu_machine_dependent_reorg (void)
*** 2657,2662 ****
--- 2661,2668 ----
spu_var_tracking ();
+ loop_optimizer_finalize ();
+
free_bb_for_insn ();
in_spu_reorg = 0;
Index: gcc/config/spu/t-spu-elf
===================================================================
*** gcc/config/spu/t-spu-elf (revision 190390)
--- gcc/config/spu/t-spu-elf (working copy)
*************** spu.o: $(CONFIG_H) $(SYSTEM_H) coretypes
*** 23,29 ****
real.h insn-config.h conditions.h insn-attr.h flags.h $(RECOG_H) \
$(OBSTACK_H) $(TREE_H) $(EXPR_H) $(OPTABS_H) except.h function.h \
output.h $(BASIC_BLOCK_H) $(GGC_H) $(HASHTAB_H) \
! $(TM_P_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h reload.h \
$(srcdir)/config/spu/spu-protos.h \
$(srcdir)/config/spu/spu-builtins.def
--- 23,29 ----
real.h insn-config.h conditions.h insn-attr.h flags.h $(RECOG_H) \
$(OBSTACK_H) $(TREE_H) $(EXPR_H) $(OPTABS_H) except.h function.h \
output.h $(BASIC_BLOCK_H) $(GGC_H) $(HASHTAB_H) \
! $(TM_P_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h reload.h $(CFGLOOP_H) \
$(srcdir)/config/spu/spu-protos.h \
$(srcdir)/config/spu/spu-builtins.def
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
prev parent reply other threads:[~2012-08-15 22:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-13 13:02 [PATCH] Remove basic_block->loop_depth Richard Guenther
2012-08-14 10:16 ` Ulrich Weigand
2012-08-14 10:51 ` Richard Guenther
2012-08-14 11:00 ` Steven Bosscher
2012-08-14 11:01 ` Richard Guenther
2012-08-15 12:04 ` [rfc] Fix SPU build (Re: [PATCH] Remove basic_block->loop_depth) Ulrich Weigand
2012-08-15 12:07 ` Richard Guenther
2012-08-15 22:18 ` Ulrich Weigand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201208152217.q7FMHjJT006657@d06av02.portsmouth.uk.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).