From patchwork Wed Nov 29 22:39:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 842792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-468183-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ZRZfYbJj"; dkim-atps=neutral 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 3ynFqP71Zqz9sDB for ; Thu, 30 Nov 2017 09:40:32 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=j1nyaTy5eoHF dJB75I8gZ6HXy2NTaogx/cOiIcA7dhojEWEdvdXDnvDhmjCpCXRLIBSNecv4ebDR wEzasouom92NUJPNX2mRGemtOxO/v4FS+2iAcwYsMLv8rXuXC1d3ID9kCu61xMgC qgRfQSeh3VJQaJV3QoBRPjP0t4Z4Ukk= 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:from :to:cc:subject:date:message-id; s=default; bh=x1yY0QA+4z3wX3rIhG DXJmjOpmk=; b=ZRZfYbJjSdPjPPYegBLBBaQw79aAMYb16Kx4y3dz9XLYFtv7CS zh0htbBYrSpPN/yN5TuZNA4D2Ne3pk/01qQpC0dXAuI4MIHwrhQVINXqoCh+9dCO iFcdaOZmhHPsYOCADO9U+aPqCTsDWJyJkKneb7Xa/7Grlcb6OdzU1nbtU= Received: (qmail 10378 invoked by alias); 29 Nov 2017 22:39:57 -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 10095 invoked by uid 89); 29 Nov 2017 22:39:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KB_WAM_FROM_NAME_SINGLEWORD, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Nov 2017 22:39:55 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 1F87112407DF; Wed, 29 Nov 2017 22:39:54 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: [PATCH] combine: Do not throw away unneeded arms of parallels (PR83156) Date: Wed, 29 Nov 2017 22:39:52 +0000 Message-Id: <0776170fc3a421ad4800eaee1f9288addc72c361.1511994888.git.segher@kernel.crashing.org> X-IsSubscribed: yes The fix for PR82621 makes us not split an I2 if one of the results of those SETs is unused, since combine does not handle that properly. But this results in degradation for i386 (or more in general, for any target that does not have patterns for parallels with an unused result as a CLOBBER instead of a SET for that result). This patch instead makes us not split only if one of the results is set again before I3. That fixes PR83156 and also fixes PR82621. Unfortunately it undoes the nice optimisations that the previous patch did, on powerpc. Tested on powerpc64-linux {-m32,-m64}; committing to trunk. Segher 2017-11-29 Segher Boessenkool PR rtl-optimization/83156 PR rtl-optimization/82621 * combine.c (try_combine): Don't split an I2 if one of the dests is set again before I3. Allow unused dests. --- gcc/combine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/combine.c b/gcc/combine.c index 8462397..c578e47 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3042,7 +3042,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, && can_split_parallel_of_n_reg_sets (i2, 2) && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 0)), i2, i3) && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3) - && !find_reg_note (i2, REG_UNUSED, 0)) + && !reg_set_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 0)), i2, i3) + && !reg_set_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3)) { /* If there is no I1, there is no I0 either. */ i0 = i1;