From patchwork Tue Feb 20 18:49:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 875848 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-473613-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="wAQ4DqYP"; 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 3zmG603w7Kz9rxp for ; Wed, 21 Feb 2018 09:50:00 +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:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=tGS1rWaf8oBlDqnzQV7jkoZN5QotgENMW8rCGiLxCbk5adeEoqgkk Oh2jKs+/AYYeg50NZ6dN7V7zd3uXqR2IzkS1QnW+XU2lxoaHgiYqzdUzDVpQG/8i crDEvYa5zvoXa6DJ20BJrEdLVukvc12bCbSQ/ekKuBk4zljnLYJhDU= 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:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=n6Ih+N/0SG4/04xIANpWEvDVfrU=; b=wAQ4DqYPXBymcLEQgGFl RqyOiwbLnvvFK168EQc3TOlrz0maHEYTcg5iRbTfkMom/q95MdCEPtcPMT36mPKe RQJcjZ5aBRNiBwaiT704uS4cfSBPud64+A+DFnbo98xAhy63Ssx2Onjm6Ekzt2A0 e1/l7MZCN8Wi8ayKDrz3cCI= Received: (qmail 111103 invoked by alias); 20 Feb 2018 18:49:58 -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 111090 invoked by uid 89); 20 Feb 2018 18:49:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Feb 2018 18:49:57 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EABCC03675D for ; Tue, 20 Feb 2018 18:49:56 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-67.rdu2.redhat.com [10.10.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E69F60BE5 for ; Tue, 20 Feb 2018 18:49:55 +0000 (UTC) From: Jeff Law Subject: [PATCH][committed][PR tree-optimization/82123] 01/06 Do nothing in EVRP analyzer is not optimizing To: gcc-patches Message-ID: <8ab6de14-3e50-37bb-4c15-f25b788875d8@redhat.com> Date: Tue, 20 Feb 2018 11:49:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 X-IsSubscribed: yes This is part #1 of the patches to fix 81592/82123. The changes aren't particularly large or invasive, but I already had them broken down internally into distinct chunks, so I'm going to send them out that way. This patch allows the EVRP range analyzer to be safely called even when not optimizing. It does no analysis in that case. This prevents problems if we were to ask for sprintf warnings but not have the optimizer enabled. Bootstrapped and regression tested on x86_64-linux-gnu. Jeff * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::enter): Do nothing if not optimizing. (evrp_range_analyzer::record_ranges_from_stmt): Likewise. (evrp_range_analyzer::pop_to_marker): Likewise. diff --git a/gcc/gimple-ssa-evrp-analyze.c b/gcc/gimple-ssa-evrp-analyze.c index 2eb2769..b9dcf90 100644 --- a/gcc/gimple-ssa-evrp-analyze.c +++ b/gcc/gimple-ssa-evrp-analyze.c @@ -69,6 +69,8 @@ evrp_range_analyzer::push_marker () void evrp_range_analyzer::enter (basic_block bb) { + if (!optimize) + return; push_marker (); record_ranges_from_incoming_edge (bb); record_ranges_from_phis (bb); @@ -279,6 +281,9 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary) { tree output = NULL_TREE; + if (!optimize) + return; + if (dyn_cast (stmt)) ; else if (stmt_interesting_for_vrp (stmt)) @@ -390,6 +395,8 @@ evrp_range_analyzer::pop_to_marker (void) void evrp_range_analyzer::leave (basic_block bb ATTRIBUTE_UNUSED) { + if (!optimize) + return; pop_to_marker (); }