From patchwork Wed Jul 7 11:25:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 58102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0AB9DB6EEB for ; Wed, 7 Jul 2010 21:27:06 +1000 (EST) Received: (qmail 10393 invoked by alias); 7 Jul 2010 11:27:05 -0000 Received: (qmail 10383 invoked by uid 22791); 7 Jul 2010 11:27:04 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Jul 2010 11:26:59 +0000 Received: (qmail 15791 invoked from network); 7 Jul 2010 11:26:57 -0000 Received: from unknown (HELO ?84.152.177.221?) (bernds@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Jul 2010 11:26:57 -0000 Message-ID: <4C346442.9080600@codesourcery.com> Date: Wed, 07 Jul 2010 13:25:54 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100625 Thunderbird/3.0.5 MIME-Version: 1.0 To: GCC Patches CC: Kazu Hirata Subject: Followup fix for auto-inc-dec.c, PR44404 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Kazu recently made a change in auto-inc-dec.c to avoid using count_occurrences in one case, since it doesn't handle hard registers correctly. There was a patch posted at http://gcc.gnu.org/ml/gcc-patches/2010-06/msg00514.html which looks correct, but a different patch was checked in: @@ -1068,6 +1068,13 @@ find_inc (bool first_try) /* For the post_add to work, the result_reg of the inc must not be used in the mem insn since this will become the new index register. */ + if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) == 0 + && reg_overlap_mentioned_p (inc_insn.reg_res, PATTERN (mem_insn.insn))) + { + debug_rtx (mem_insn.insn); + debug_rtx (inc_insn.reg_res); + gcc_unreachable (); + } if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) != 0) { if (dump_file) which isn't actually fixing anything, just causing an abort when we encounter the problematic situation. This triggers on the PR44404 testcase if my ARM ldm/stm peephole patch is applied. I'll be checking in the below as obvious after some testing. There are some more calls to count_occurrences in auto-inc-dec.c which worry me a bit, but that's a problem for another day. Bernd PR rtl-optimization/44404 * auto-inc-dec.c (find_inc): Avoid calling count_occurrences if possible, use reg_overlap_mentioned_p instead. Index: auto-inc-dec.c =================================================================== --- auto-inc-dec.c (revision 161824) +++ auto-inc-dec.c (working copy) @@ -1068,14 +1068,7 @@ find_inc (bool first_try) /* For the post_add to work, the result_reg of the inc must not be used in the mem insn since this will become the new index register. */ - if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) == 0 - && reg_overlap_mentioned_p (inc_insn.reg_res, PATTERN (mem_insn.insn))) - { - debug_rtx (mem_insn.insn); - debug_rtx (inc_insn.reg_res); - gcc_unreachable (); - } - if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) != 0) + if (reg_overlap_mentioned_p (inc_insn.reg_res, PATTERN (mem_insn.insn))) { if (dump_file) fprintf (dump_file, "base reg replacement failure.\n");