From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24135 invoked by alias); 15 Aug 2012 12:04:46 -0000 Received: (qmail 24103 invoked by uid 22791); 15 Aug 2012 12:04:43 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,MSGID_FROM_MTA_HEADER,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e06smtp15.uk.ibm.com (HELO e06smtp15.uk.ibm.com) (195.75.94.111) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Aug 2012 12:04:29 +0000 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 15 Aug 2012 13:04:27 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 15 Aug 2012 13:04:27 +0100 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7FC4KR430539906 for ; Wed, 15 Aug 2012 12:04:20 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7FC4QPd000758 for ; Wed, 15 Aug 2012 06:04:26 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q7FC4N7p000624; Wed, 15 Aug 2012 06:04:24 -0600 Message-Id: <201208151204.q7FC4N7p000624@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 15 Aug 2012 14:04:23 +0200 Subject: [rfc] Fix SPU build (Re: [PATCH] Remove basic_block->loop_depth) To: rguenther@suse.de (Richard Guenther) Date: Wed, 15 Aug 2012 12:04:00 -0000 From: "Ulrich Weigand" Cc: gcc-patches@gcc.gnu.org In-Reply-To: from "Richard Guenther" at Aug 14, 2012 12:48:21 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit x-cbid: 12081512-0342-0000-0000-0000029330E6 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-08/txt/msg00962.txt.bz2 Richard Guenther wrote: > On Tue, 14 Aug 2012, Ulrich Weigand wrote: > > Looks like this broke SPU build, since spu_machine_dependent_reorg > > accesses ->loop_depth. According to comments in the code, this > > was done because of concerns that loop_father may no longer be set up > > this late in compilation, so I'm wondering whether just replacing > > this by loop_depth (bb->loop_father) would work here ... > If SPU md reorg would like to look at loop structures it should > compute them. Simply call flow_loops_find, which hopefully works > in CFG RTL mode (which I think is the mode available from md reorg?). 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? Thanks, Ulrich ChangeLog: * config/spu/spu.c: Include "cfgloop.h". (spu_machine_dependent_reorg): Call loop_optimizer_init and loop_optimizer_finalize. Use loop_father instead of loop_depth. * 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,2580 ---- 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) ! && (loop_depth (prev->loop_father) ! <= loop_depth (bb->loop_father))) 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; --- 2583,2589 ---- && 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))); --- 2605,2611 ---- 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, loop_depth (bb->loop_father), INSN_UID (branch), loop_exit, simple_loop, branch_addr - INSN_ADDRESSES (INSN_UID (bbend))); *************** spu_machine_dependent_reorg (void) *** 2657,2662 **** --- 2662,2669 ---- 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