From patchwork Mon Mar 7 23:41:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 593752 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5CDB714012C for ; Tue, 8 Mar 2016 10:41:22 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=BIdmDTWI; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=m8r2Exj7cg77x2vwFeWzr/xiB1uKT BOYp+ITVyIibEg8fZGJJ1YVhJ+yuFT1qMD+yx09lImaFKQ1Sahe0DDhmryivWbSd EhvzYBh3fCUj3ZsUfxNNQj2TvWe5Z50xyXfkgt/wnMReM/sGMUYzro7FSLKrgxCd j9ULXjvQxFN6ls= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=HRCVzuXZDAQMt+3ed5Qno/JMlFc=; b=BId mDTWIf4J7xyEnZLI7UsbWgMGW7FylB0slMkEHtzNpLU7NoI/2R6nrtN2QsveQdOi aMfj3oYXT2xYhnS6LcQ1cjAPuhsGO3aMe3QellqDUx4HuDcLHTv+85rBPk1QxQJn ofrn2suBQl19sn0xH1KYg9ci7dYn5xJZkb53WS1Y= Received: (qmail 26283 invoked by alias); 7 Mar 2016 23:41:13 -0000 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 Received: (qmail 26256 invoked by uid 89); 7 Mar 2016 23:41:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=20160308, 2016-03-08, Hx-languages-length:2017, late X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 07 Mar 2016 23:41:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 3386C8B137; Mon, 7 Mar 2016 23:41:10 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u27Nf8XB028832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 7 Mar 2016 18:41:09 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u27Nf6ok025575; Tue, 8 Mar 2016 00:41:07 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u27Nf5JK025574; Tue, 8 Mar 2016 00:41:05 +0100 Date: Tue, 8 Mar 2016 00:41:05 +0100 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ICE with i?86 stv (PR target/70110) Message-ID: <20160307234105.GA3017@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi! What the STV pass does is clearly wrong, it meant to grab a sequence of instructions out of a sequence and emit it somewhere else, but calls end_sequence too late, so the sequence bookkepping vars get corrupted. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-03-08 Jakub Jelinek PR target/70110 * config/i386/i386.c (scalar_chain::make_vector_copies, scalar_chain::convert_reg): Call end_sequence in between get_insns and emit_conversion_insns rather than after both calls. * gcc.dg/pr70110.c: New test. Jakub --- gcc/config/i386/i386.c.jj 2016-03-04 21:27:48.000000000 +0100 +++ gcc/config/i386/i386.c 2016-03-07 10:03:44.465981310 +0100 @@ -3272,8 +3272,9 @@ scalar_chain::make_vector_copies (unsign gen_rtx_SUBREG (SImode, reg, 4)); emit_move_insn (vreg, tmp); } - emit_conversion_insns (get_insns (), insn); + rtx_insn *seq = get_insns (); end_sequence (); + emit_conversion_insns (seq, insn); if (dump_file) fprintf (dump_file, @@ -3348,8 +3349,9 @@ scalar_chain::convert_reg (unsigned regn emit_move_insn (gen_rtx_SUBREG (SImode, scopy, 4), adjust_address (tmp, SImode, 4)); } - emit_conversion_insns (get_insns (), insn); + rtx_insn *seq = get_insns (); end_sequence (); + emit_conversion_insns (seq, insn); if (dump_file) fprintf (dump_file, --- gcc/testsuite/gcc.dg/pr70110.c.jj 2016-03-07 10:16:22.211631464 +0100 +++ gcc/testsuite/gcc.dg/pr70110.c 2016-03-07 10:16:05.000000000 +0100 @@ -0,0 +1,39 @@ +/* PR target/70110 */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ +/* { dg-additional-options "-msse2" { target i?86-*-* x86_64-*-* } } */ + +int a, c, d, f, h; +long long b; + +static inline void +foo (void) +{ + if (a) + foo (); + b = c; +} + +static inline void +bar (int p) +{ + if (p) + f = 0; + b |= c; +} + +void +baz (int g, int i) +{ + for (b = d; (d = 1) != 0; ) + { + if (a) + foo (); + b |= c; + bar (h); + bar (g); + bar (h); + bar (i); + bar (h); + } +}