From patchwork Wed Nov 26 10:07:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 415055 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 1127414017A for ; Wed, 26 Nov 2014 21:14:09 +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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=DhJyz3R/i33x5NrOn++C0rLeXbTgT3dtyL7FWLFYqWNk0CSmwKnht teilLHj3NrR3xZdcEwdrrazoBTOsxEV5geRjA51H2tlhKE3dOKFS6KceLVN7bi5r Y061GejDPhVNGLPc4yk0g6MHqnlLrZid5tv8e95Ge1wxIXmH5wJjAg= 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=ThF565GFgSNRK4ugCZO4Ouc/868=; b=fTw12pzP/UG154iNMKok Yg/l64rCNEAWeH67uaMxqVBu9XJZAfjx/YH63Y/BR49PSwvc5+UVJRBeaL3vDGTB Oj67fy38vlOKIhBKgfN/LjzLM70eUBxngDOZLFMgU+9IVatx5oK3Ia+YryGMi24M edUoCI4ypflrI1xC0bL2z/0= Received: (qmail 31846 invoked by alias); 26 Nov 2014 10:14:02 -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 31828 invoked by uid 89); 26 Nov 2014 10:14:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 26 Nov 2014 10:14:00 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 710FCABE2 for ; Wed, 26 Nov 2014 10:13:57 +0000 (UTC) Date: Wed, 26 Nov 2014 11:07:48 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix overly restrictive condition in get_symbol_constant_value Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 The following fixes an overly restrictive condition on the zeros we produce when folding a read from a zero-initialized global. Now it matches what we allow elsewhere and what is useful. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2014-11-26 Richard Biener * gimple-fold.c (get_symbol_constant_value): Allow all GIMPLE register type zero-constants. Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 218073) +++ gcc/gimple-fold.c (working copy) @@ -254,8 +254,7 @@ get_symbol_constant_value (tree sym) have zero as the initializer if they may not be overridden at link or run time. */ if (!val - && (INTEGRAL_TYPE_P (TREE_TYPE (sym)) - || SCALAR_FLOAT_TYPE_P (TREE_TYPE (sym)))) + && is_gimple_reg_type (TREE_TYPE (sym))) return build_zero_cst (TREE_TYPE (sym)); }