From patchwork Mon Oct 26 12:26:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 535905 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 4E40314027C for ; Mon, 26 Oct 2015 23:26:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Ivb6pPQl; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=RQL8w4tDTWYz1xu+ZqdFQ86++9IEJzK4qXgHryZZEqiZPWs6S/ g+nJETf54srqdjRDamQHx9Tz2QAynd5pozGFY+0l3mOJtqojCu7Ti4+DotKMlbDs GLI0UwupKIGkwwR1cY37JlJL39ZheCWa66K82ysQ9zuinpSTgjh5qDnZo= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=PScNzITnxj4bJZajatC1N+LMXck=; b=Ivb6pPQlbptBGLyTzw9J Sl/8Q6I7+zzikocbW6Caib8YM9FqoyzjIuur79uUqdm3JPM78OWsMKdSmh6STIGs oBS7TLDUpcipGl32Tp3FvWqwl3uTbpZ9lXpzSpdRiE3Mmok7Sm3gVVLIlpbnv7YM N4adBQ9jAwf+Aqc9ZgzAg48= Received: (qmail 27269 invoked by alias); 26 Oct 2015 12:26:52 -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 27258 invoked by uid 89); 26 Oct 2015 12:26:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 26 Oct 2015 12:26:50 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42335) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZqgrP-0000HX-UF for gcc-patches@gnu.org; Mon, 26 Oct 2015 08:26:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqgrM-0001u0-9C for gcc-patches@gnu.org; Mon, 26 Oct 2015 08:26:47 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:45871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqgrM-0001tg-3D for gcc-patches@gnu.org; Mon, 26 Oct 2015 08:26:44 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZqgrK-0001Bl-O4 from Tom_deVries@mentor.com for gcc-patches@gnu.org; Mon, 26 Oct 2015 05:26:43 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Mon, 26 Oct 2015 12:26:40 +0000 To: "gcc-patches@gnu.org" From: Tom de Vries Subject: [RFC] Improving alias dumps Message-ID: <562E1BF2.7060304@mentor.com> Date: Mon, 26 Oct 2015 13:26:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 Hi, After spending some time looking at ealias/pta dumps, I realized that they're hard to understand because we use varinfo names to identify varinfos, while those names are not necessarily unique. F.i., for a function f: ... void f (int *__restrict__ a, int *__restrict__ b) { *a = 1; *b = 2; } ... we have at ealias the constraints: ... a = &PARM_NOALIAS PARM_NOALIAS = NONLOCAL b = &PARM_NOALIAS PARM_NOALIAS = NONLOCAL derefaddrtmp = &NONLOCAL *a = derefaddrtmp derefaddrtmp = &NONLOCAL *b = derefaddrtmp ... F.i. PARM_NOALIAS occurs several times, and it's not clear if there are one or two varinfos with that name. Using attached patch, it's clearer what varinfos the constraints relate to: ... a(8) = &PARM_NOALIAS(9) PARM_NOALIAS(9) = NONLOCAL(5) b(10) = &PARM_NOALIAS(11) PARM_NOALIAS(11) = NONLOCAL(5) derefaddrtmp(12) = &NONLOCAL(5) *a(8) = derefaddrtmp(12) derefaddrtmp(13) = &NONLOCAL(5) *b(10) = derefaddrtmp(13) ... It this a good idea, f.i. guarded by (dump_flags & TDF_DETAILS) not to disturb scans of current tests? Or, do we f.i. want to fix the names themselves to be unique? Thanks, - Tom Improve alias dump accuracy diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 3510683..4ea1f43 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -660,7 +660,7 @@ dump_constraint (FILE *file, constraint_t c) fprintf (file, "&"); else if (c->lhs.type == DEREF) fprintf (file, "*"); - fprintf (file, "%s", get_varinfo (c->lhs.var)->name); + fprintf (file, "%s(%u)", get_varinfo (c->lhs.var)->name, c->lhs.var); if (c->lhs.offset == UNKNOWN_OFFSET) fprintf (file, " + UNKNOWN"); else if (c->lhs.offset != 0) @@ -670,7 +670,7 @@ dump_constraint (FILE *file, constraint_t c) fprintf (file, "&"); else if (c->rhs.type == DEREF) fprintf (file, "*"); - fprintf (file, "%s", get_varinfo (c->rhs.var)->name); + fprintf (file, "%s(%u)", get_varinfo (c->rhs.var)->name, c->rhs.var); if (c->rhs.offset == UNKNOWN_OFFSET) fprintf (file, " + UNKNOWN"); else if (c->rhs.offset != 0) @@ -5823,10 +5823,10 @@ dump_solution_for_var (FILE *file, unsigned int var) /* Dump the solution for unified vars anyway, this avoids difficulties in scanning dumps in the testsuite. */ - fprintf (file, "%s = { ", vi->name); + fprintf (file, "%s(%u) = { ", vi->name, vi->id); vi = get_varinfo (find (var)); EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi) - fprintf (file, "%s ", get_varinfo (i)->name); + fprintf (file, "%s(%u) ", get_varinfo (i)->name, i); fprintf (file, "}"); /* But note when the variable was unified. */