From patchwork Wed Nov 17 06:44:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 71530 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 38673B7181 for ; Wed, 17 Nov 2010 17:44:30 +1100 (EST) Received: (qmail 13483 invoked by alias); 17 Nov 2010 06:44:29 -0000 Received: (qmail 13470 invoked by uid 22791); 17 Nov 2010 06:44:27 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, TW_AV, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 17 Nov 2010 06:44:23 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 16 Nov 2010 22:44:22 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by fmsmga001.fm.intel.com with ESMTP; 16 Nov 2010 22:44:22 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id E24AF1808FA; Tue, 16 Nov 2010 22:44:21 -0800 (PST) Date: Tue, 16 Nov 2010 22:44:21 -0800 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Uros Bizjak Subject: PATCH: Properly check the end of basic block Message-ID: <20101117064421.GA30836@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi, We may have insn != BB_END (bb) && NEXT_INSN (insn) == NEXT_INSN (BB_END (bb)) We should check NEXT_INSN (insn) != NEXT_INSN (BB_END (bb)) in move_or_delete_vzeroupper_2. This patch does it. OK for trunk? Thanks. H.J. ---- 2010-11-16 H.J. Lu * config/i386/i386.c (move_or_delete_vzeroupper_2): Properly check the end of basic block. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index e52f9b2..704a67d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -108,7 +108,7 @@ check_avx256_stores (rtx dest, const_rtx set, void *data) static void move_or_delete_vzeroupper_2 (basic_block bb, bool upper_128bits_set) { - rtx insn; + rtx insn, last; rtx vzeroupper_insn = NULL_RTX; rtx pat; int avx256; @@ -118,9 +118,12 @@ move_or_delete_vzeroupper_2 (basic_block bb, bool upper_128bits_set) bb->index, upper_128bits_set); insn = BB_HEAD (bb); + last = NEXT_INSN (BB_END (bb)); while (insn != BB_END (bb)) { insn = NEXT_INSN (insn); + if (insn == last) + break; if (!NONDEBUG_INSN_P (insn)) continue;