From patchwork Tue Dec 6 18:10:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 86894 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2153199qgi; Tue, 6 Dec 2016 10:11:12 -0800 (PST) X-Received: by 10.84.139.67 with SMTP id 61mr136091754plq.65.1481047872148; Tue, 06 Dec 2016 10:11:12 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id d9si20347038pge.35.2016.12.06.10.11.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 10:11:12 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443626-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443626-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443626-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=sF5oG36PFgCHDHu3il19QLpggk9WOJCkJFMMdX8z0fId1PuyAo vEFIYkLG4vlf/2uW6tHKO7wwSObSCLRoyok28HIiXWROJpcJg9RJuGlpZDuEct3k OZzP442Uj9UMcQ0Wal2nqr+DLGGl8jLy38laeHZ0BCAULzU0lm1S+6y84= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=rpbhF8aNHvIDQlRIsRm+1gBQftA=; b=CCPC59OaBHoCk0dRncYU cWj8oJFgh7npgoFaLfhC1lSkN9HlG0xN2JkIA1dO29yfgNOWJhK8/foVgWVgncXB PblnpyjGChqcfzaoYcHoKhlxMqZZuB0J19ruIt7um8T+exfRgfxwjeCD7ILJr6BS w+vD5Q3X3W2CdnpjkaihaRo= Received: (qmail 116657 invoked by alias); 6 Dec 2016 18:10:56 -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 116645 invoked by uid 89); 6 Dec 2016 18:10:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=ira, Hx-languages-length:2025 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 ESMTP; Tue, 06 Dec 2016 18:10:54 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D3ECE80F8E for ; Tue, 6 Dec 2016 18:10:53 +0000 (UTC) Received: from localhost.localdomain ([10.36.126.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB6IAqfm007463 for ; Tue, 6 Dec 2016 13:10:53 -0500 To: GCC Patches From: Bernd Schmidt Subject: IRA combine_and_move_insns fix, PR78669 Message-ID: <757fbe34-09f4-9020-4a2e-4178d44ef109@redhat.com> Date: Tue, 6 Dec 2016 19:10:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-IsSubscribed: yes In this PR, we have two registers with "replace" set for them. When processing the first, we delete its setter, which happens to be the only use of the other register. In the second iteration we then assert that the other register has a use, which would be reasonable if we hadn't deleted it. The following fixes it. Bootstrapped and tested on x86_64-linux, ok? Bernd PR rtl-optimization/78669 * ira.c (combine_and_move_insns): When deleting an insn, clear the replace flag for all used regs in that insn. PR rtl-optimization/78669 * gcc.target/i386/pr78669.c: New test. Index: gcc/ira.c =================================================================== --- gcc/ira.c (revision 242958) +++ gcc/ira.c (working copy) @@ -3705,6 +3705,14 @@ combine_and_move_insns (void) remove_death (regno, use_insn); SET_REG_N_REFS (regno, 0); REG_FREQ (regno) = 0; + df_ref use; + FOR_EACH_INSN_USE (use, def_insn) + { + unsigned int use_regno = DF_REF_REGNO (use); + if (!HARD_REGISTER_NUM_P (use_regno)) + reg_equiv[use_regno].replace = 0; + } + delete_insn (def_insn); reg_equiv[regno].init_insns = NULL; Index: gcc/testsuite/gcc.target/i386/pr78669.c =================================================================== --- gcc/testsuite/gcc.target/i386/pr78669.c (nonexistent) +++ gcc/testsuite/gcc.target/i386/pr78669.c (working copy) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-Os -fno-tree-ter -mavx512bw " } */ +typedef __int128 u128; +typedef __int128 v64u128 __attribute__((vector_size(64))); + +v64u128 v64u128_g; + +static inline v64u128 +baz(v64u128 v64u128_0, v64u128 v64u128_3) +{ + v64u128_0 |= (v64u128){} == v64u128_0; + v64u128_3 = (v64u128){} >= v64u128_3; + return v64u128_0 + v64u128_3; +} + +static void __attribute__((noinline, noclone)) +bar(u128 u128_0, v64u128 v64u128_3) +{ + v64u128_g = baz((v64u128){(u128)1 << 64, u128_0}, v64u128_3); +} + +void +foo(v64u128 v64u128_3) +{ + bar(3, v64u128_3); +}