From patchwork Mon Nov 11 10:38:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 290238 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 142A92C009E for ; Mon, 11 Nov 2013 21:38:34 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=XHFhp+/pGVYJl3p43d ErUdkAvFWXgo0s/5E2H8gzuuIRlrmwi+DIdN3vfW2WQJkvq9dxszw1/xkSNS8gwl dk3qHV3ihHGPJC9qHkXnIUYMpZAwVMeAANpvy0AcxEpdmMy7Qw9R2Iq5rEzAeU5f NAKLhtvz6bK7bmXngpEnCeCao= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=LPM7UDcdxY/30eIpiH+rjti1 1pQ=; b=tabvw8U6yFIqjfWxYipSAWxfW9Y0+otXYTbmUsdOe3BNx1rcOcQV1THP sqy4JauWVAaTp1V2pLOiaBNuoi7K0Wz59UMb0bxpWv+kNmtdHosWVixnzpmyehdM rTj71imNlJ4+us6C6i6bkGQ603lFwTxd20N3GDRrkFj9OMaCn+k= Received: (qmail 7921 invoked by alias); 11 Nov 2013 10:38:23 -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 7908 invoked by uid 89); 11 Nov 2013 10:38:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=AWL, BAYES_40, FREEMAIL_FROM, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-wi0-f175.google.com Received: from Unknown (HELO mail-wi0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 11 Nov 2013 10:38:21 +0000 Received: by mail-wi0-f175.google.com with SMTP id hm11so1916362wib.14 for ; Mon, 11 Nov 2013 02:38:12 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.103.169 with SMTP id fx9mr4265944wib.50.1384166292277; Mon, 11 Nov 2013 02:38:12 -0800 (PST) Received: by 10.195.12.114 with HTTP; Mon, 11 Nov 2013 02:38:12 -0800 (PST) In-Reply-To: <527D0B20.5010505@redhat.com> References: <527D0B20.5010505@redhat.com> Date: Mon, 11 Nov 2013 11:38:12 +0100 Message-ID: Subject: Re: RFA: Fix PR middle-end/59049 From: Richard Biener To: Jeff Law Cc: Steven Bosscher , Joern Rennecke , GCC Patches , Jakub Jelinek X-IsSubscribed: yes On Fri, Nov 8, 2013 at 5:02 PM, Jeff Law wrote: > On 11/08/13 07:45, Steven Bosscher wrote: >> >> On Fri, Nov 8, 2013 at 3:40 PM, Joern Rennecke >> wrote: >>> >>> bootstrapped / regtested on i686-pc-linux-gnu. >> >> >> Not a very elaborate description of the patch, eh? :-) >> >> This is IMHO not OK without at least an explanation of why the >> comparison of two const_ints is not folded. Better yet would be to fix >> that underlying problem. We should not present such non-sense to the >> RTL parts of the middle end. > Agreed. In this case it's fold-all-builtins folding a strlen call with a PHI <"foo", "bar"> argument. IMHO not presenting RTL with such non-sense is best achieved by not letting TER do constant propagation (because it doesn't "fold" the result). We can never rule out such stray non-propagated constants, so that makes expand more robust (and hopes for RTL CCP). return false; does that make sense? I'll test it then. Thanks, Richard. > jeff > Index: gcc/tree-ssa-ter.c =================================================================== --- gcc/tree-ssa-ter.c (revision 204664) +++ gcc/tree-ssa-ter.c (working copy) @@ -438,6 +439,12 @@ ter_is_replaceable_p (gimple stmt) && !is_gimple_val (gimple_assign_rhs1 (stmt))) return false; + /* Do not propagate "modeless" constants - we may end up confusing the RTL + expanders. Leave the optimization to RTL CCP. */ + if (gimple_assign_single_p (stmt) + && CONSTANT_CLASS_P (gimple_assign_rhs1 (stmt))) + return false; + return true; }