From patchwork Fri Nov 17 09:05:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 838900 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-467090-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="uzbhcT+O"; 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 3ydXKC22LQz9s4q for ; Fri, 17 Nov 2017 20:06:05 +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=ZVKstfPoUsisxkSFTRdhRttkEtoPznIDU3uTEwiUWPGaHqa5qAfHW +w9SeZQC+4hWtPGFAYU9s+yir9g5eJinmiaVxkM6WsAP/fuZ1C5C0ww1bc3teQT+ kuFzNuwNyX1DO3lVSVp0yn5xVXENbkPL4TqBd4jIzT/x4g5n+gJoMM= 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=65LGetDydf7rNryYF6qyo5iNRe4=; b=uzbhcT+Opf36S6InKNv9 pSjHFiPJTCU3sI/K97NJkN2pm9b3dRqBwt68qNrJFxwIPfgBoyH3auxH04j6i+1n TlALS/dNP97vbol5PceJvdKKZ/rEiO2LbXIJicnbF7ddPlziDL40AidCKnf31XLb TNkUlSODGqjgtYKmQ9AfRyg= Received: (qmail 77625 invoked by alias); 17 Nov 2017 09:05:54 -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 77216 invoked by uid 89); 17 Nov 2017 09:05:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=treessaprec, UD:tree-ssa-pre.c, tree-ssa-pre.c, expresion X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Nov 2017 09:05:52 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7AA2CAAAD for ; Fri, 17 Nov 2017 09:05:49 +0000 (UTC) Date: Fri, 17 Nov 2017 10:05:48 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Remove some useless work in PRE Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 VN already sees if an expresion is fully constant so there's no reason to duplicate that work during PHI translation. I've verified with an assert the paths are indeed unreachable. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2017-11-17 Richard Biener * tree-ssa-pre.c (phi_translate_1): Remove redundant constant folding of references. Index: gcc/tree-ssa-pre.c =================================================================== --- gcc/tree-ssa-pre.c (revision 254797) +++ gcc/tree-ssa-pre.c (working copy) @@ -1566,7 +1566,6 @@ phi_translate_1 (pre_expr expr, bitmap_s if (changed || newvuse != vuse) { unsigned int new_val_id; - pre_expr constant; tree result = vn_reference_lookup_pieces (newvuse, ref->set, ref->type, @@ -1611,15 +1610,7 @@ phi_translate_1 (pre_expr expr, bitmap_s expr->id = 0; if (newref) - { - PRE_EXPR_REFERENCE (expr) = newref; - constant = fully_constant_expression (expr); - if (constant != expr) - return constant; - - new_val_id = newref->value_id; - get_or_alloc_expression_id (expr); - } + new_val_id = newref->value_id; else { if (changed || !same_valid) @@ -1637,12 +1628,9 @@ phi_translate_1 (pre_expr expr, bitmap_s newoperands, result, new_val_id); newoperands = vNULL; - PRE_EXPR_REFERENCE (expr) = newref; - constant = fully_constant_expression (expr); - if (constant != expr) - return constant; - get_or_alloc_expression_id (expr); } + PRE_EXPR_REFERENCE (expr) = newref; + get_or_alloc_expression_id (expr); add_to_value (new_val_id, expr); } newoperands.release ();