From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65376 invoked by alias); 18 Jan 2017 15:34:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 65357 invoked by uid 89); 18 Jan 2017 15:34:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=our 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; Wed, 18 Jan 2017 15:34:51 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7401FAC3D; Wed, 18 Jan 2017 15:34:48 +0000 (UTC) Subject: Re: [PATCH] Speed-up use-after-scope (re-writing to SSA) (version 2) To: Jakub Jelinek References: <20161116130733.GT3541@tucnak.redhat.com> <469bf86a-e43c-c571-66e4-87db78b6fb11@suse.cz> <20161116162841.GX3541@tucnak.redhat.com> <20161221085200.GS21933@tucnak> <4ec48432-9df6-154a-1b13-065b9772cbbf@suse.cz> <20161222172140.GF21933@tucnak> <29d32a7c-a95d-ddb1-d64e-ae8f659d3a4b@suse.cz> <20170116142025.GO1867@tucnak> <7e7f795d-a7a7-584e-8c77-61ea01207c40@suse.cz> <20170117164721.GE1867@tucnak> Cc: Richard Biener , GCC Patches From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Wed, 18 Jan 2017 15:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170117164721.GE1867@tucnak> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg01351.txt.bz2 Hello. During bootstrap, I came to following test-case: struct A { int regno; }; struct { A base; } typedef *df_ref; int *a; void fn1 (int N) { for (int i = 0; i < N; i++) { df_ref b; a[(b)->base.regno]++; } } As we expand all usages of an LHS of a ASAN_POISON to all uses, we propagate that to a PHI node that originally contained ASAN_MARK (UNPOISON): [0.00%]: ASAN_MARK (UNPOISON, &b, 8); a.0_1 = a; b.1_2 = b; _3 = b.1_2->base.regno; _4 = (long unsigned int) _3; _5 = _4 * 4; _6 = a.0_1 + _5; _7 = *_6; _8 = _7 + 1; *_6 = _8; ASAN_MARK (POISON, &b, 8); i_17 = i_9 + 1; goto ; [0.00%] Is transformed to: [0.00%]: # i_9 = PHI <0(2), i_17(4)> # b_18 = PHI if (i_9 >= N_13(D)) goto ; [0.00%] else goto ; [0.00%] [0.00%]: a.0_1 = a; b.1_2 = b_18; _3 = b.1_2->base.regno; _4 = (long unsigned int) _3; _5 = _4 * 4; _6 = a.0_1 + _5; _7 = *_6; _8 = _7 + 1; *_6 = _8; b_20 = ASAN_POISON (); i_17 = i_9 + 1; goto ; [0.00%] Motivation for propagation over PHI nodes was: cat use.c int main (int argc, char **argv) { int *ptr = 0; if (argc == 1) { int my_char; ptr = &my_char; } if (ptr) return *ptr; return 0; } I'm thinking whether the selected approach is fundamentally wrong, our we'll have to stop the PHI propagation and we still be able to catch some cases with -O2? Thanks, Martin