From patchwork Fri Jul 12 07:59:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1131194 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-504965-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="cfVEtLPL"; 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 45lQMl2XgPz9s8m for ; Fri, 12 Jul 2019 18:00:34 +1000 (AEST) 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:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=DLJlCAK1ir51AKl+/FioJiqyZHs8gpUywt3CMExP4UGQAEJedsL8Z qIJwI01+gi37VAiqTyCkK9nTqn9svgZEh2nDRaPTS4hp1XAX8Y4UWd6+qiQjdTfy C6eqvPgHlJhZxbxD75r49hRJiyTJ7f1S6tfXm7Utkwcx4t6VWwdSA8= 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:subject:date:message-id:mime-version:content-type; s= default; bh=LGOW1uBb4vvSjBpMuklSsjYe4xo=; b=cfVEtLPLoByRC6z35GRw LtLwMml3pkJT9ibAxWHwf+9zUpQLPKe0FQhgMfKs/HwbNARkCt7xLXJQCIkFDSdR jMz/EHCHnrzIXh9fOBJnQ5YWD7DtgwXlYTvotr1DEJedMCsk71C8CGoVlU5/4w5c 8iz/yr3r6zXQ4eJYJ41t3+4= Received: (qmail 35188 invoked by alias); 12 Jul 2019 08:00:26 -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 35058 invoked by uid 89); 12 Jul 2019 08:00:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jul 2019 08:00:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 63D93337 for ; Fri, 12 Jul 2019 01:00:00 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 09B503F59C for ; Fri, 12 Jul 2019 00:59:59 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Make ifcvt clean up dead comparisons Date: Fri, 12 Jul 2019 08:59:58 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 This change is needed to avoid a regression in gcc.dg/ifcvt-3.c for a later patch. Without it, we enter CSE with a dead comparison left by if-conversion and then eliminate the second (live) comparison in favour of the dead one. That's functionally correct in itself, but it meant that we'd combine the subtraction and comparison into a SUBS before we have a chance to fold away the subtraction. Tested on aarch64-linux-gnu, aarch64_be-elf and x86_64-linux-gnu. OK to install? Richard 2019-07-11 Richard Sandiford gcc/ * ifcvt.c: Include dce.h. (if_convert): Call run_fast_dce if the pass changed something. Index: gcc/ifcvt.c =================================================================== --- gcc/ifcvt.c 2019-03-08 18:15:26.828777872 +0000 +++ gcc/ifcvt.c 2019-07-12 08:58:21.787403345 +0100 @@ -46,6 +46,7 @@ #include "rtl-iter.h" #include "ifcvt.h" #include "params.h" +#include "dce.h" #ifndef MAX_CONDITIONAL_EXECUTE #define MAX_CONDITIONAL_EXECUTE \ @@ -5443,6 +5444,10 @@ if_convert (bool after_combine) num_true_changes); } + if (num_updated_if_blocks) + /* Get rid of any dead CC-related instructions. */ + run_fast_dce (); + if (optimize == 1) df_remove_problem (df_live);