From patchwork Tue Mar 10 07:57:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 448366 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 143B0140146 for ; Tue, 10 Mar 2015 18:57:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ElHbbt83; dkim-adsp=none (unprotected policy); 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:subject:message-id:mime-version:content-type; q=dns; s= default; b=TRYThxyAi0G3KpgN/0BuzRS4HWLMLJ3wVHq8gLPfnZW4F8iixmuKB +HRew/bxCapUwoDdJ+sUq3kJc7D1iKRpJdQBtM0EtAvX6WVAKL0Plw+GqepCvQg4 7GqcVEHWLFYgQDDXkFm8GvrTMGNaixebF21bp+O4fb6jITNF1H327E= 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:subject:message-id:mime-version:content-type; s= default; bh=iBzlxUHS9B9yn1FTGjj7VWWdApI=; b=ElHbbt83p8GswI3OQgEl 86LN6aT/vN5PPpFKd4ByFd6SQWj0OvV9t9WjHCGgefe46AJQdoZGWiHuFmYbU6MD rz2+IK9zpqfh7bT3543E/5HHgemQsMHR+NUnWAlVzblxUjjVkOVmo5bXj5S28vnG I1KY67nQMkR+XIMcS/npbGc= Received: (qmail 128234 invoked by alias); 10 Mar 2015 07:57:16 -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 128214 invoked by uid 89); 10 Mar 2015 07:57:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp15.uk.ibm.com Received: from e06smtp15.uk.ibm.com (HELO e06smtp15.uk.ibm.com) (195.75.94.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 10 Mar 2015 07:57:15 +0000 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Mar 2015 07:57:12 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Mar 2015 07:57:09 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id E720B17D8042 for ; Tue, 10 Mar 2015 07:57:30 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2A7v98P10748204 for ; Tue, 10 Mar 2015 07:57:09 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t2A7v9J9001040 for ; Tue, 10 Mar 2015 01:57:09 -0600 Received: from bart (dyn-9-152-212-204.boeblingen.de.ibm.com [9.152.212.204]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id t2A7v7P9000999 for ; Tue, 10 Mar 2015 01:57:08 -0600 Received: by bart (sSMTP sendmail emulation); Tue, 10 Mar 2015 08:57:08 +0100 Date: Tue, 10 Mar 2015 08:57:08 +0100 From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [PATCH] Run DCE after if conversion Message-ID: <20150310075708.GA7213@maggie> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15031007-0021-0000-0000-0000032B083B X-IsSubscribed: yes Hi, the combine pass sometimes gets confused by already dead compares which are remains of the if conversion pass. This e.g. happens in gcc.dg/builtin-bswap-7.c. Compiling with -march=z196 the if blocks are modified to make use of load on condition. This duplicates the compare insn but unfortunately ifcvt fails to clean it up and the additional compare survives until the second ifcvt pass. Combine fails to do the simplification of the bswap since the bswapped value appears to be used in the second compare as well. ifcvt runs df_analyze in a loop until nothing changes anymore. So this loop is always left with all df solutions being clean. However, dce is only run once, before the first iteration. The attached patch fixes the builtin-bswap-7.c testcase for s390x (-march=z196) but is probably helpful in other situations as well. Ok? Bye, -Andreas- 2015-03-10 Andreas Krebbel * gcc/ifcvt.c (if_convert): diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index a3e3e5c..d2040af 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -4626,6 +4626,13 @@ if_convert (bool after_combine) num_true_changes); } + if (num_true_changes > 0) + { + df_set_flags (DF_LR_RUN_DCE); + df_mark_solutions_dirty (); + df_analyze (); + } + if (optimize == 1) df_remove_problem (df_live);