From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25075 invoked by alias); 9 Sep 2019 13:42:27 -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 25067 invoked by uid 89); 9 Sep 2019 13:42:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:af95d48, HX-Languages-Length:2789, H*i:sk:af95d48 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; Mon, 09 Sep 2019 13:42:26 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3672DAE2F; Mon, 9 Sep 2019 13:42:24 +0000 (UTC) Date: Mon, 09 Sep 2019 13:42:00 -0000 From: Richard Biener To: =?ISO-8859-15?Q?Martin_Li=A8ka?= cc: Li Jia He , Andrew Pinski , Jeff Law , GCC Patches , Segher Boessenkool , wschmidt@linux.ibm.com, Martin Liska Subject: Re: [PATCH 1/2] Auto-generate maybe_fold_and/or_comparisons from match.pd In-Reply-To: Message-ID: References: <1561615913-22109-1-git-send-email-helijia@linux.ibm.com> <6fb28248-5134-cec5-5045-45253e4d2eb0@redhat.com> <6d333ccf-9905-e929-c2dc-fc611ff929f1@linux.ibm.com> <845bc280-7bd6-509b-3830-4ebde50f1b20@linux.ibm.com> <863e9c71-7639-eaf9-fa13-32515ce0452f@suse.cz> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1609908220-63819698-1568036544=:5566" X-SW-Source: 2019-09/txt/msg00516.txt.bz2 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609908220-63819698-1568036544=:5566 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Content-length: 3062 On Mon, 9 Sep 2019, Martin Liška wrote: > On 9/9/19 3:10 PM, Richard Biener wrote: > > On Mon, 9 Sep 2019, Martin Liška wrote: > > > >> Hi. > >> > >> I'm sending slightly updated version of the patch where we > >> need to properly select type in maybe_fold_comparisons_from_match_pd > >> function for the created SSA_NAMEs. We can be called for a VECTOR_TYPE > >> and so that we can't return a boolean_type_node. > >> > >> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > >> > >> Ready to be installed? > > > > 2019-07-16 Li Jia He > > Martin Liska > > > > * gimple.h (gimple_init): Declare. > > (gimple_size): Likewise. > > * gimple.c (gimple_init): Remove static and inline restrictions. > > (gimple_alloc): Only allocate memory and call gimple_init. > > (gimple_size): Likewise. > > > > Likewise? > > Fixed. > > > > > * tree-ssanames.c (init_ssa_name_imm_use): Use make_ssa_name_fn. > > (make_ssa_name_fn): New. > > > > You didn't touch make_ssa_name_fn. > > Likewise here. > > > > > Since we're needing another iteration: > > > > + /* Allocate gimple stmt1 on the stack. */ > > + gimple *stmt1 = (gimple *) XALLOCAVEC (char, gimple_size > > (GIMPLE_ASSIGN, 2)); > > > > You can use gassign *stmt1 here so all the gimple_assign_ fns below > > get cheaper. > > > > + if (op.resimplify (NULL, follow_all_ssa_edges)) > > + { > > + if (gimple_simplified_result_is_gimple_val (&op)) > > + { > > + tree res = op.ops[0]; > > + switch (TREE_CODE (res)) > > + { > > + case SSA_NAME: > > + { > > + gimple *def = SSA_NAME_DEF_STMT (res); > > > > you shouldn't expand SSA names here unless that SSA name is > > exactly lhs1 or lhs2 from above. So > > Ah, got it. > > > > > if (res == lhs1) > > return build2 (...); > > else if (res == lhs2) > > return build2 (..); > > else > > return res; > > > > plus you miss the case where 'op' became a simplified comparison > > in itself. So, > > Yes, that part is included in part 3. I'm going to send the updated patch > 3 as well soon. > > > > > if (op.code.is_tree_code () > > && TREE_CODE_CLASS ((enum tree_code)op.code) == tcc_comparison) > > { > > tree op0 = op.ops[0]; > > tree op1 = op.ops[1]; > > if (op0 == lhs1 || op0 == lhs2 || op1 == lhs1 || op1 == lhs2) > > return NULL_TREE; /* not simple */ > > return build2 ((enum tree_code)op.code, op.type, > > op0, op1); > > } > > > > note you need not fold_ again. It's of course ugly that we > > need to build a GENERIC tree here but that's the current interface > > and thus OK at the moment. > > I see. But what I need is to insert newly created GIMPLE assignment to > the provided gimple sequence (gsi), right? There is no newly created GIMPLE? Richard. ---1609908220-63819698-1568036544=:5566--