From patchwork Tue Oct 9 11:42:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 981160 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-487197-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="KfNCwhMT"; 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 42TwNF0hZ7z9s7W for ; Tue, 9 Oct 2018 22:43:24 +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=kGn5CXdWgNYu4ChKLSJb/OOE/zKxW0mo7h/gbU+0bN8Tj5GCE0tnM C9kyAWsTujjuq6t1lLRkEi+VkEe3mI60vKvn8Mx0ViyQg5fUadJVP9aVV5B3PULf ByMEH1iho/aDqS01BRGW5338m6S9O6VbGfz+oXBxfZerC12kJ1llT0= 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=THBEkm+lXaUYSeb+L1c4+QhEMCQ=; b=KfNCwhMTQYYZlqM84sE2 /ZClblfazu49PYcMJxajmOamS5grsByg5usjLyzdTE6psGW0KDMKaKEUMBtLDeE6 zrm2MM8AQfJO8A6Ro7LhKuNJHRYbiiz9zRWyjW0o8yXI/yLLkGwSxDQ1wRGZngRl GCgvL1wuRi3/oBrNI+fUiQw= Received: (qmail 75245 invoked by alias); 9 Oct 2018 11:43:11 -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 73204 invoked by uid 89); 9 Oct 2018 11:42:50 -0000 Authentication-Results: sourceware.org; auth=none 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, SPF_PASS autolearn=ham version=3.3.2 spammy=resort, Help X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Oct 2018 11:42:49 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EE4EAAFF6 for ; Tue, 9 Oct 2018 11:42:46 +0000 (UTC) Date: Tue, 9 Oct 2018 13:42:46 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Help PR63155 PTA hog a bit Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 This helps us throw away constraints from uninitialized stuff earlier. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2018-10-09 Richard Biener PR tree-optimization/63155 * tree-ssa-structalias.c: Include tree-ssa.h. (get_constraint_for_ssa_var): For undefs return nothing_id. (find_func_aliases): Cleanup PHI handling. diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 22558351138..06ac0016e03 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -42,6 +42,7 @@ #include "varasm.h" #include "stringpool.h" #include "attribs.h" +#include "tree-ssa.h" /* The idea behind this analyzer is to generate set constraints from the program, then solve the resulting constraints in order to generate the @@ -2928,15 +2929,26 @@ get_constraint_for_ssa_var (tree t, vec *results, bool address_p) /* We allow FUNCTION_DECLs here even though it doesn't make much sense. */ gcc_assert (TREE_CODE (t) == SSA_NAME || DECL_P (t)); - /* For parameters, get at the points-to set for the actual parm - decl. */ if (TREE_CODE (t) == SSA_NAME - && SSA_NAME_IS_DEFAULT_DEF (t) - && (TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL - || TREE_CODE (SSA_NAME_VAR (t)) == RESULT_DECL)) + && SSA_NAME_IS_DEFAULT_DEF (t)) { - get_constraint_for_ssa_var (SSA_NAME_VAR (t), results, address_p); - return; + /* For parameters, get at the points-to set for the actual parm + decl. */ + if (TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL + || TREE_CODE (SSA_NAME_VAR (t)) == RESULT_DECL) + { + get_constraint_for_ssa_var (SSA_NAME_VAR (t), results, address_p); + return; + } + /* For undefined SSA names return nothing. */ + else if (!ssa_defined_default_def_p (t)) + { + cexpr.var = nothing_id; + cexpr.type = SCALAR; + cexpr.offset = 0; + results->safe_push (cexpr); + return; + } } /* For global variables resort to the alias target. */ @@ -4833,35 +4845,19 @@ find_func_aliases (struct function *fn, gimple *origt) gimple *t = origt; auto_vec lhsc; auto_vec rhsc; - struct constraint_expr *c; varinfo_t fi; /* Now build constraints expressions. */ if (gimple_code (t) == GIMPLE_PHI) { - size_t i; - unsigned int j; - /* For a phi node, assign all the arguments to the result. */ get_constraint_for (gimple_phi_result (t), &lhsc); - for (i = 0; i < gimple_phi_num_args (t); i++) + for (unsigned i = 0; i < gimple_phi_num_args (t); i++) { - tree strippedrhs = PHI_ARG_DEF (t, i); - - STRIP_NOPS (strippedrhs); get_constraint_for_rhs (gimple_phi_arg_def (t, i), &rhsc); - - FOR_EACH_VEC_ELT (lhsc, j, c) - { - struct constraint_expr *c2; - while (rhsc.length () > 0) - { - c2 = &rhsc.last (); - process_constraint (new_constraint (*c, *c2)); - rhsc.pop (); - } - } + process_all_all_constraints (lhsc, rhsc); + rhsc.truncate (0); } } /* In IPA mode, we need to generate constraints to pass call