From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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:08:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-07/txt/msg00933.txt.bz2 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);