From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23752 invoked by alias); 15 Oct 2004 15:49:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23733 invoked by uid 48); 15 Oct 2004 15:49:06 -0000 Date: Fri, 15 Oct 2004 15:49:00 -0000 Message-ID: <20041015154906.23732.qmail@sourceware.org> From: "amylaar at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040711232647.16482.kkojima@gcc.gnu.org> References: <20040711232647.16482.kkojima@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug target/16482] [4.0 Regression] gcc.c-torture/unsorted/SFset.c fails with "-O2 -m4" X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg02109.txt.bz2 List-Id: ------- Additional Comments From amylaar at gcc dot gnu dot org 2004-10-15 15:49 ------- Looking closer, I see that sched-deps.c already has code to keep branches, calls and USEs at the end of the last basic block. The problem is that lcm.c:optimize_mode_switching has put some instructions after the USE before sched1 is run. In this code: /* Split the edge from the entry block and the fallthrough edge to the exit block, so that we can note that there NORMAL_MODE is supplied / required. */ edge eg; edge_iterator ei; post_entry = split_edge (EDGE_SUCC (ENTRY_BLOCK_PTR, 0)); /* The only non-call predecessor at this stage is a block with a fallthrough edge; there can be at most one, but there could be none at all, e.g. when exit is called. */ pre_exit = 0; FOR_EACH_EDGE (eg, ei, EXIT_BLOCK_PTR->preds) if (eg->flags & EDGE_FALLTHRU) { regset live_at_end = eg->src->global_live_at_end; gcc_assert (!pre_exit); pre_exit = split_edge (eg); COPY_REG_SET (pre_exit->global_live_at_start, live_at_end); COPY_REG_SET (pre_exit->global_live_at_end, live_at_end); break; } } We create a new block at the end to put the final mode switch into. If the fall-through predecessor of the exit block is the only predecessor of the exit block, and it ends with a USE, then instead of split_edge we should use split_block, to place the USE and the preceding copy from the result to the return value register into the new block. I would write a patch for this, but the copyright assignment for STM is not finished yet. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16482