From patchwork Sun Mar 21 16:16:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 12153123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69F1BC433DB for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34BA261864 for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbhCUQSZ (ORCPT ); Sun, 21 Mar 2021 12:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230042AbhCUQSO (ORCPT ); Sun, 21 Mar 2021 12:18:14 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D8FC061762 for ; Sun, 21 Mar 2021 09:18:13 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id b16so16481833eds.7 for ; Sun, 21 Mar 2021 09:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wah0v4FjWHZbJaov8QIevKHi9R8Q9SEewwcmnNESkh8=; b=ctOaDbn/ug1qvoTGVy1xqGPrEYhQhGvewTuOlSjab61fbm60A9SRcFA5ZRUAS9H59I +o05TSnM0lN5CEsK5umDJah36j9q1AcukhrGmLuetXyK3cXjtMt9DH9s5pRiX4TnzARu uwx5U86b1wVzlGP0vemLu0UT+j6F4HnKiOgJO6Bl0vng+1I3Jq8YeJb/kcoX8hwNGzCi 71KLO/S5gHIETfBv0ZXc78bq8bpXR2Uy946O24UBxCqJp3QMfxiN2MWgza4CpsjJ6y1m pVrT44W2RqKTrqXS/RzFzRwlEjpIlaDld+fUNrBUM/7xd+dUpqpB/YoD0D6/ZlGfNPAY x5hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wah0v4FjWHZbJaov8QIevKHi9R8Q9SEewwcmnNESkh8=; b=MG1+fNcj6vZMuB9TBh0GbWhZqRU24X8yNKk0o8aDsQd4amfmbtUvNjItungrkrJbP2 j2nb5T4pmDsTxjf5BJ64PwOw5milm2XwW7GVa8uCRUELkd1LYFuGMLt6Ah4jrN70QEUU 31OT9EInZygNDytEQDxM4sDtMLkvlVIIsqFjXoj6WNMzfPd0l6vprAeN/+V/YsPAP5Lv JsogO9dMBJnkS5SlH0hMWzGjzlFKOkPb9e1Emlwzsw9xselOq89j8G+7QTRws9Wsu/Uy 0dHmMZi939KVWJ8WyqCQZnhkBA4kst9Vqc41P8TILnW+nhNgEewrzt7WBFFrN8NZj3y2 +BxA== X-Gm-Message-State: AOAM5331WFiOa0TcolCHJlqKMEWbdPOvSDcljSjTOSP1a+jWk4nzQjUW 3iKrnMD9a0CPmXKAPfKItLM7iYGcOUA= X-Google-Smtp-Source: ABdhPJwIFLFMqny6hm5t45KsdEzPj+UUrQ/gK3l+pbea/7zLAdMewltP/Uy3Vfn1dbYTMsef3IFyzA== X-Received: by 2002:aa7:d385:: with SMTP id x5mr21405147edq.289.1616343492632; Sun, 21 Mar 2021 09:18:12 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7fe:f700:dc34:259e:8292:82c0]) by smtp.gmail.com with ESMTPSA id c20sm7390295eja.22.2021.03.21.09.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 09:18:12 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 1/6] add insert_last_instruction() Date: Sun, 21 Mar 2021 17:16:04 +0100 Message-Id: <20210321161609.45905-2-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> References: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org It's relatively common to have to add an instruction at the end of a BB. More exactly, at the end but just before the terminator instruction. What is done for this is: 1) remove the terminator 2) add the new instruction 3) add the terminator back This is a bit tedious, need to declare a temporary variable for the terminator and, more generally, it's low-level details. So, add an helper for doing this: insert_last_instruction(). Signed-off-by: Luc Van Oostenryck --- linearize.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linearize.h b/linearize.h index b6c8bf134065..493f6be1074c 100644 --- a/linearize.h +++ b/linearize.h @@ -195,6 +195,14 @@ static inline void add_instruction(struct instruction_list **list, struct instru add_ptr_list(list, insn); } +static inline void insert_last_instruction(struct basic_block *bb, struct instruction *insn) +{ + struct instruction *last = delete_last_instruction(&bb->insns); + add_instruction(&bb->insns, insn); + add_instruction(&bb->insns, last); + insn->bb = bb; +} + static inline void add_multijmp(struct multijmp_list **list, struct multijmp *multijmp) { add_ptr_list(list, multijmp); From patchwork Sun Mar 21 16:16:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 12153133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 105DFC433E2 for ; Sun, 21 Mar 2021 16:19:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFBFD61939 for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230042AbhCUQSZ (ORCPT ); Sun, 21 Mar 2021 12:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230045AbhCUQSP (ORCPT ); Sun, 21 Mar 2021 12:18:15 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2FE3C061574 for ; Sun, 21 Mar 2021 09:18:14 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id t18so17352246ejc.13 for ; Sun, 21 Mar 2021 09:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qfzNAIQKTocxOKBw2AQcH96LuSXXG5QoeqiTaPup7WA=; b=Im9IPBFIIOjEiRK55BQ+nYCuXsQcZebfs6jIKLZY2Soaj6DSdGB/t/6JlqLbARnzhD s8yFPFeV0ncGHeyeC+2KIQRKic80CS8arcEeGXao2NKsnlmOCM1N5SxkYildAMIstG+l B7g3ZCruwFEzQJG6OI0t0Cvw/WE/1xEYHFFRrf/v73GCqtUxFzCg1OAId22EllcYwVKA mUvIw/dOkRCLvIlDmyb8t+6KE2jO1BA7E+VdROv223WRfUTU/kFyURE0kpQhfXfX+ooh yXdeKOS6S0+fprNOk0WefDzi9cSUVshEgHRj6SiPhk33pyKoazkuw91onDg2T0/iK3g+ JRjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qfzNAIQKTocxOKBw2AQcH96LuSXXG5QoeqiTaPup7WA=; b=md3ptIfoRL1reJhC3UGjQUY1afBbAvLnq3CoGmqtMyfJ05KUEp/IlKHOw6Q9YZjDIv 3+rq333cp5KY3k/dZcYwKW6xDGG/guBGI+ChwYxBiDzQp/WeNYDo2Qk0ZGN2OG2blEcg QLvRkmab2QqcHwHgww4jcRrgHcoIzyf3fKKua59hc62HqZk7pWxgyPwPKxipleLUSPZl V+Hv5LpIvOSJlA5Lsq8rV/65Q2IushsCiPNn61aHUj4UkzJrQgxyyavorizRxC7+ZkDy lUSlizyed6ivWfs9oLuhpA2giq0FASrqVytNJHBhQp+hX7b4YvSjItbUOrYP22AwF1K1 Co2A== X-Gm-Message-State: AOAM532RXAgrQEUJdYPN4orPvjONRSj6j8UwOlaQy8ODipXvQK+M3/Zx Lyf9Vo6kYQs9M4Rp60t79oFQadB3dGg= X-Google-Smtp-Source: ABdhPJyzTP/jGvp8cVku+1ymLOJUx3rWn5xEyvOrlrMGLzNwXa5TLp9pMYYWFPWdZqSQuhuCl1prVg== X-Received: by 2002:a17:907:3ea0:: with SMTP id hs32mr14783344ejc.411.1616343493497; Sun, 21 Mar 2021 09:18:13 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7fe:f700:dc34:259e:8292:82c0]) by smtp.gmail.com with ESMTPSA id c20sm7390295eja.22.2021.03.21.09.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 09:18:13 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 2/6] replace add_instruction_to_end() by insert_last_instruction() Date: Sun, 21 Mar 2021 17:16:05 +0100 Message-Id: <20210321161609.45905-3-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> References: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org add_instruction_to_end() and insert_last_instruction() do exactly the same thing but with the arguments in the opposite order. So, replace add_instruction_to_end() by insert_last_instruction(). Signed-off-by: Luc Van Oostenryck --- cse.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cse.c b/cse.c index 1e58a973ecf6..b59581814ab7 100644 --- a/cse.c +++ b/cse.c @@ -298,14 +298,6 @@ static inline void remove_instruction(struct instruction_list **list, struct ins delete_ptr_list_entry((struct ptr_list **)list, insn, count); } -static void add_instruction_to_end(struct instruction *insn, struct basic_block *bb) -{ - struct instruction *br = delete_last_instruction(&bb->insns); - insn->bb = bb; - add_instruction(&bb->insns, insn); - add_instruction(&bb->insns, br); -} - static struct instruction * try_to_cse(struct entrypoint *ep, struct instruction *i1, struct instruction *i2) { struct basic_block *b1, *b2, *common; @@ -343,7 +335,7 @@ static struct instruction * try_to_cse(struct entrypoint *ep, struct instruction if (common) { i1 = cse_one_instruction(i2, i1); remove_instruction(&b1->insns, i1, 1); - add_instruction_to_end(i1, common); + insert_last_instruction(common, i1); } else { i1 = i2; } From patchwork Sun Mar 21 16:16:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 12153125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4C50C433E1 for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FA3961937 for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbhCUQS0 (ORCPT ); Sun, 21 Mar 2021 12:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbhCUQSQ (ORCPT ); Sun, 21 Mar 2021 12:18:16 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8960C061574 for ; Sun, 21 Mar 2021 09:18:15 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id b9so17383918ejc.11 for ; Sun, 21 Mar 2021 09:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iCsFKI9TUgdSg1jVahlz/s+ILL2yniqy6o05AhOsS0I=; b=RoKk+FdsGk00WzygtKkgCQvvj1Dt5h6PVh9M5rp840QP1Ev1PO9XBdRyBql6eGJhI1 aFjd3+Vw5rKDyWoXtaMCYj0r2QifNgTH8IXYwn7qg0UBKV/JmUX8neHV5hv0AT3ZRiEv JTyR/QejzM6VXCz8+wQOB748+L3FgSyUxHGRmDa3SlfVRnZJC82l1ygpoaI4zKN0ekQ3 QGCi1S0cN3nm/DfUssmLJskb077F+XN08SuwsaFENL8z6696qDohVxGSzECqTqObB4Hz 785nQMb4EtUalAq4aRHjpL45zT6ZEv+pPDa74T9EL5QpYTQTE46/dWCxzTZaL20lyPRe qzeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iCsFKI9TUgdSg1jVahlz/s+ILL2yniqy6o05AhOsS0I=; b=B/1Pd8swMbC+xykwCXxOQEsr5TzkppSLmDRCAU5tLwj++SCT2aZKV+iZFyp+/MJkaN 1iJ7AfYVa8UIiRrtYnI+3fX5EBI8SbuBI0wi1mPtnJ9pgxS5O8V4a08wobz8Y5BunIx/ /h8O3FALdqus0kDnJJK64VQJFlD4JlIRk+jmB+2aG7nU1LPvE2uL/mEpx0/7ipgg5i8f XQvPZOE0Sb/xkzWErE/Vvgg6PEbVCi5/x5amr+D4+dye7K2vaDnii2/c6sDZrrmQKAq3 gUQx6+YS56o0H/W4MyTm7sWlGmGkexSwDNXMQqXGrBM8px3N920BfzPimrHDMzVVrAtG z9ww== X-Gm-Message-State: AOAM5310iaqP5JvEyfKJyYxiOAN+TIbeXyYRJPlsL99fwHaut8qMInV+ zAsrtZxqw7qI2egqKiOr/xiLRM6/IXU= X-Google-Smtp-Source: ABdhPJwUuRApPPdcwX5uqFYYBjM5FcGUDsWSJLDJMN28y5KNyCNXKI08Uy3fLnux9K/l0liW92fabQ== X-Received: by 2002:a17:907:9611:: with SMTP id gb17mr15458067ejc.325.1616343494407; Sun, 21 Mar 2021 09:18:14 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7fe:f700:dc34:259e:8292:82c0]) by smtp.gmail.com with ESMTPSA id c20sm7390295eja.22.2021.03.21.09.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 09:18:13 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 3/6] let insert_select() use insert_last_instruction() Date: Sun, 21 Mar 2021 17:16:06 +0100 Message-Id: <20210321161609.45905-4-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> References: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Signed-off-by: Luc Van Oostenryck --- linearize.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/linearize.c b/linearize.c index e6aa01f1b9fe..4787689b37b8 100644 --- a/linearize.c +++ b/linearize.c @@ -697,11 +697,7 @@ void insert_select(struct basic_block *bb, struct instruction *br, struct instru pseudo_t target; struct instruction *select; - /* Remove the 'br' */ - delete_last_instruction(&bb->insns); - select = alloc_typed_instruction(OP_SEL, phi_node->type); - select->bb = bb; assert(br->cond); use_pseudo(select, br->cond, &select->src1); @@ -714,8 +710,7 @@ void insert_select(struct basic_block *bb, struct instruction *br, struct instru use_pseudo(select, if_true, &select->src2); use_pseudo(select, if_false, &select->src3); - add_instruction(&bb->insns, select); - add_instruction(&bb->insns, br); + insert_last_instruction(bb, select); } static inline int bb_empty(struct basic_block *bb) From patchwork Sun Mar 21 16:16:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 12153127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8BDFC433E3 for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B934C61934 for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbhCUQS0 (ORCPT ); Sun, 21 Mar 2021 12:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbhCUQSQ (ORCPT ); Sun, 21 Mar 2021 12:18:16 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7634AC061574 for ; Sun, 21 Mar 2021 09:18:16 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id kt15so7893562ejb.12 for ; Sun, 21 Mar 2021 09:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DcxS5hCDG0lEfkrheNDZDSCZbWYpv20H6bBFF7zpaT8=; b=mwhAF4/FCs/W+ME0S1AjKIsCu+1qH/fC3IBOQsXPM33AuTWSA2E1gXtiVEOGhXHezm iSUduvZ+TyU3Ecx1AFgAo6sqC2a6ZXBhG59+fiQn105iB/PrPurh7Y0o9qiVYvQG6QhA TKhXamINWnvfL0Q2MeCcVvaA/WLUv5vu0TpSN3HsKXc7M+2U4S77cE1rz+54wVHpt3hs f9CUgdJDqSG0sQulGZD80XTC0ddPiPqL2nXh25lyyirjcHD6HXeKmbTCw+H7w8kNJ4+A PgesampwNybjtBaAD24Z12g+KAL5uRKAAbDj21F8erriyzUP2cF2CVgqxEIro5EthAWZ 8oig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DcxS5hCDG0lEfkrheNDZDSCZbWYpv20H6bBFF7zpaT8=; b=naUa8Ax9pKZoGrIsSxAGzp5L23ttj+9SVhyJW5T5MgVK6BftygeZdvQoNWqDko96M5 ibKVKRNAVx3mJ+cD9ZnGCY/RVeFpJzEIwKWIbnA9TwrQ+S3OGsmB4/uMDPZY/iCqNkL2 O4o9iH6x5o27YnVWGPQJ490X545DTgKWdotj8DCZ3NZss/myBxPVh+PTFxh6adwwNHsa th2cTKYlQItqmEp61A60JIuJMWTxkVdiQnBibfXQOhBezBgHwyda+3ZG9ehjd3fMp+hc TkGxcWdcqROuUSGo4xiFhsERwfwagRw19DO7VRgrhqh835IFbKM/TmuzPPYhhme8KW7F H1eg== X-Gm-Message-State: AOAM53347ahpEF50m7K40vkEyx8ixp91+AVpvjC39BFQau+55gCDsS32 ElsXj/v3LCmdw8iLrQujeudg8MldInE= X-Google-Smtp-Source: ABdhPJwTqIz0mc2RKy57mI8uNj7sS4W5O1P3pDJJJGakwSErzbNVDrl3wxcayaU/1/YxlH0lpcp4hw== X-Received: by 2002:a17:906:3395:: with SMTP id v21mr15202169eja.322.1616343495253; Sun, 21 Mar 2021 09:18:15 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7fe:f700:dc34:259e:8292:82c0]) by smtp.gmail.com with ESMTPSA id c20sm7390295eja.22.2021.03.21.09.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 09:18:14 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 4/6] let insert_phis() use insert_last_instruction() Date: Sun, 21 Mar 2021 17:16:07 +0100 Message-Id: <20210321161609.45905-5-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> References: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Signed-off-by: Luc Van Oostenryck --- linearize.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/linearize.c b/linearize.c index 4787689b37b8..95fb3b59b90b 100644 --- a/linearize.c +++ b/linearize.c @@ -1708,10 +1708,9 @@ static void insert_phis(struct basic_block *bb, pseudo_t src, struct symbol *cty struct basic_block *parent; FOR_EACH_PTR(bb->parents, parent) { - struct instruction *br = delete_last_instruction(&parent->insns); - pseudo_t phi = alloc_phi(parent, src, ctype); - add_instruction(&parent->insns, br); - link_phi(node, phi); + struct instruction *phisrc = alloc_phisrc(src, ctype); + insert_last_instruction(parent, phisrc); + link_phi(node, phisrc->target); } END_FOR_EACH_PTR(parent); } From patchwork Sun Mar 21 16:16:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 12153129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9FCAC433E0 for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B2D261864 for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbhCUQS0 (ORCPT ); Sun, 21 Mar 2021 12:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230053AbhCUQSR (ORCPT ); Sun, 21 Mar 2021 12:18:17 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A222C061574 for ; Sun, 21 Mar 2021 09:18:17 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id b9so17383984ejc.11 for ; Sun, 21 Mar 2021 09:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eo9svFSXNAbzExMJ8PSOaDkeNUCU7lNCsywyf5d6/FU=; b=j9pUDGOXKq8vC0xW5OhcZuwmapD5CL6M8eaKQztEkm86TRKMNOZvyKTmLdY8d71jPI ePM7TTsCE+f/kh6LJVJpu8irTXGpnrVNUIsCE+c7OLJzbzU38FTHVBwWAQUTpuCenDsz vbUF5n36GNlm1wyRWd6lb+cJthY9g4TAyqEGg+E+0F3+5n++qdBgUqlzWCUglJx/E4s7 Y8Oxixf8yOSllMJjYaC7hC0mJ1Me42ESdFle4br407lsC3NHZam1D7WHAZd+/752NSvH Gh5TrHygKQT1I8KAF3Qw8xIGMLequLlZ7muy97glMSiTF5i1VECPGqSYrTO1ZRcqqT/8 0oRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eo9svFSXNAbzExMJ8PSOaDkeNUCU7lNCsywyf5d6/FU=; b=bCDwwKdQD7M2c12JTmK6vPJslFu1ENzO127p0QRwDsjHQzisWiQxcnAEUTqMff5gSa LUY5vmtZRfBmsvaSZWtA8+7zz7+IXgngCeFrCIzclc2zXF44TJGh2/SsxyWZVrakGqNc xAYXY5QEF/LbO9htTb/8YVQ55ZrL/FtZvhc/9C22yPufp0slDPnZvmFGkxS1iWG+WmQr LbUle7wM3BajxFWJgTHRkgKjrkdxZV/q26GmNENyl6SA0BXi79fdoKeGSOHsPWvNJvWX X6pNZScpB3O+TvZ3s7i/ydwXHaJctjQj1gAPefqM45XRrdiLWndwcuz/alZ5r10XIANn Jqfw== X-Gm-Message-State: AOAM532NRjYde2/xqnkDfwGkgf0PGLj2mtQWlwyZv26QI2Zbq7coxguS LypCHe4Roh5CbvUkdCXRcpVmHUaoRyY= X-Google-Smtp-Source: ABdhPJwTAtDiFtkjYGpX6sEvyJdasnk9+OVZE+DJMImBPb8LrQ8db/qFmVvGiLAvQRc7YA1LyBe22A== X-Received: by 2002:a17:906:e0d6:: with SMTP id gl22mr14918049ejb.444.1616343496112; Sun, 21 Mar 2021 09:18:16 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7fe:f700:dc34:259e:8292:82c0]) by smtp.gmail.com with ESMTPSA id c20sm7390295eja.22.2021.03.21.09.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 09:18:15 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 5/6] let find_dominating_parents() use insert_last_instruction() Date: Sun, 21 Mar 2021 17:16:08 +0100 Message-Id: <20210321161609.45905-6-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> References: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Signed-off-by: Luc Van Oostenryck --- memops.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/memops.c b/memops.c index ff54208e2d54..f74bff2abf88 100644 --- a/memops.c +++ b/memops.c @@ -65,8 +65,8 @@ static int find_dominating_parents(pseudo_t pseudo, struct instruction *insn, struct basic_block *parent; FOR_EACH_PTR(bb->parents, parent) { + struct instruction *phisrc; struct instruction *one; - struct instruction *br; pseudo_t phi; FOR_EACH_PTR_REVERSE(parent->insns, one) { @@ -95,12 +95,12 @@ no_dominance: continue; found_dominator: - br = delete_last_instruction(&parent->insns); - phi = alloc_phi(parent, one->target, one->type); + phisrc = alloc_phisrc(one->target, one->type); + phisrc->phi_node = insn; + insert_last_instruction(parent, phisrc); + phi = phisrc->target; phi->ident = phi->ident ? : one->target->ident; - add_instruction(&parent->insns, br); use_pseudo(insn, phi, add_pseudo(dominators, phi)); - phi->def->phi_node = insn; } END_FOR_EACH_PTR(parent); return 1; } From patchwork Sun Mar 21 16:16:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 12153131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 113ADC433E5 for ; Sun, 21 Mar 2021 16:19:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2A4A6193A for ; Sun, 21 Mar 2021 16:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230053AbhCUQS0 (ORCPT ); Sun, 21 Mar 2021 12:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbhCUQSS (ORCPT ); Sun, 21 Mar 2021 12:18:18 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4EC6C061762 for ; Sun, 21 Mar 2021 09:18:17 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a7so17366086ejs.3 for ; Sun, 21 Mar 2021 09:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WN5VWFGjCfI+jnZKuvmUolfrJcEpyaIRmr0S+DqXjlk=; b=vMKiIR9i6nKGRIWjw2Iu7uPr70LX++2m4ETEjRaXQv7u8HPLNL4/9jWY8t9e63VPP8 uydBzLSIKv7Rie6pK8AgtyQkUboE9puwySTGolXjbfqpMraul5dIwV8WJtoVbio8uBkB Tgf8TpsqlBCtXfk/7iAZ8CUwrAEoB7YjJocMtdRLfdurxmBpnS9Smx9mGZZ0QtQuD2jq QRG3QNdoMGQDrLAYCWYgyMeSVrQfELOpHk3xFsudZ4H+Tvsw5udknBwii2AyaADSklwC 0kAYDkpT8iOPIHYhZ26FJMDV2MLwgJII2aWKbDsyIRmS+NNUmE5OUxTstVKmYocd/b2k kzqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WN5VWFGjCfI+jnZKuvmUolfrJcEpyaIRmr0S+DqXjlk=; b=RlhOSjC32R4uIrnO2OvFvJYHujkf/dIoNUujQjxt1G5i4Kd8a7KQGX7seXNoIU7gMG sQ/uhD3ors4XGnTQ/b064P1efEtuOHhGkCA+Wgfe91wGy3rpE0MVTBYjNl1T4ZEY1/0L JQU2EQGW5jsQRayevqqnOKXL5HrIFoJLHaeCM7JBgUPazAxxC5zVLVTupoHvN61JfvJa BsS2dbfQEtyHcfjNz9JWbVn0C/QwgVSjJd79p/GvK6m3GGN6a3g9XcM3gRuvrj9nQ3G9 GmYpgHNEo8snEnvEEm7+TFMTjfupZVNPsdGPDQJPiEVI/HXVSrUqIL6/6K6Pv8WDVKas PrXg== X-Gm-Message-State: AOAM533UXRZfTyURYuR7I937joJZIY3kiT8SnCZXjiz+BUFTiJouB/ZY fOWVlTVKeXY19jLdxWEueBFCiIaL8No= X-Google-Smtp-Source: ABdhPJwLOnt7iPgkVPFgfXFcWTpeKnNrDWR0UkiuB27Ov9ieAZJhOhN51lIESYyopboJKh5Lpm5JnQ== X-Received: by 2002:a17:906:4015:: with SMTP id v21mr15619769ejj.433.1616343496704; Sun, 21 Mar 2021 09:18:16 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:b7fe:f700:dc34:259e:8292:82c0]) by smtp.gmail.com with ESMTPSA id c20sm7390295eja.22.2021.03.21.09.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 09:18:16 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck Subject: [PATCH 6/6] let ssa_rename_phi() use insert_last_instruction() Date: Sun, 21 Mar 2021 17:16:09 +0100 Message-Id: <20210321161609.45905-7-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> References: <20210321161609.45905-1-luc.vanoostenryck@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Signed-off-by: Luc Van Oostenryck --- ssa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ssa.c b/ssa.c index b9044207db16..5f1a52b8fe94 100644 --- a/ssa.c +++ b/ssa.c @@ -345,11 +345,11 @@ static void ssa_rename_phi(struct instruction *insn) if (!var->torename) return; FOR_EACH_PTR(insn->bb->parents, par) { - struct instruction *term = delete_last_instruction(&par->insns); pseudo_t val = lookup_var(par, var); - pseudo_t phi = alloc_phi(par, val, var); + struct instruction *phisrc = alloc_phisrc(val, var); + pseudo_t phi = phisrc->target; phi->ident = var->ident; - add_instruction(&par->insns, term); + insert_last_instruction(par, phisrc); link_phi(insn, phi); mark_phi_used(val); } END_FOR_EACH_PTR(par);