From patchwork Fri Mar 24 23:14:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9644127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D9DFF60327 for ; Fri, 24 Mar 2017 23:14:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC495200E9 for ; Fri, 24 Mar 2017 23:14:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C132626E56; Fri, 24 Mar 2017 23:14:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73DC0200E9 for ; Fri, 24 Mar 2017 23:14:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934112AbdCXXOh (ORCPT ); Fri, 24 Mar 2017 19:14:37 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35913 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755312AbdCXXOg (ORCPT ); Fri, 24 Mar 2017 19:14:36 -0400 Received: by mail-wm0-f67.google.com with SMTP id x124so780334wmf.3 for ; Fri, 24 Mar 2017 16:14:35 -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; bh=pmQcONC7oM/5SDkGDjl85w7SaaZGWysS8XDlYx/7fXg=; b=DGGIWI8ygCADND1sGRwFXI8TDU3UZpGsEV/uBkh/iowSaeVDxgVjBzn7BlwJlUaIoO bkzF8ZLHQ8z1NoPoVsv/ho0YTtSvEKabTNC73s9LJtcGQM+gUiqI0RGax2a0t8MOImha WoXpRcE5sV3dVz/qD7qUV3OBP1RZEUDpcPlsAmZOQzLKYK+dHxpBANaTIxB+faiUc+gw G9imNVA8FmFeAUB7Siz7BqtluaJSHPYeBtmQ3cX7hY29q9sL6tSj4QTSBzZ/jwr3pVd6 n8GKsRsCaxYn04L+ouFEEbrG3nSSye9EXrqdS/o2y3MbPPWAKGaENcVUJaTynuYxKz8m w/Fg== 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; bh=pmQcONC7oM/5SDkGDjl85w7SaaZGWysS8XDlYx/7fXg=; b=AugBv4Fj2T1rEJ7oN4gBOWIfiH5qVXVZ0uOWKJf76zgteqnr+NiG3yUg94w1/1Vpgd P9Z7Y6qX2KgHXFBDm18xsBo3pm5UxRTj70518ummMwNI6B92m9/KLLbbehCjFSb4wOLS NK8y/5CfIjXYooNBzBi+4Zkbg59BtSQ8KFEaGEiCwnzgDe1MjSvg59A0boRuwNysnAuj QDs46cHDNZRPBibtTLpS6xxaFo6pa51hDozk3IqD0UOsmxNJ9yhcsauc1c4yN7SMVOUW QYGABj2BAK1H1NOa5YUSRx1sEqP9peLJa5fu/ldHL+JDKp1FoUDa9YtMI3z0DnLrq1Tq xAcQ== X-Gm-Message-State: AFeK/H3nEKPGnRzpLExOKS/gHYsMFj3rhHfN7yCS0Qes9X886NaSWtl6gxEN6yCUxZRMUQ== X-Received: by 10.28.92.212 with SMTP id q203mr5081154wmb.73.1490397274738; Fri, 24 Mar 2017 16:14:34 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:802:b00:81c3:4cc:f845:762c]) by smtp.gmail.com with ESMTPSA id m188sm4160876wma.27.2017.03.24.16.14.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Mar 2017 16:14:34 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Luc Van Oostenryck Subject: [PATCH v5 07/14] inlined calls should not block BB packing Date: Sat, 25 Mar 2017 00:14:14 +0100 Message-Id: <20170324231421.14869-8-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170324231421.14869-1-luc.vanoostenryck@gmail.com> References: <20170324231421.14869-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP OP_INLINED_CALL are there only as a sort of annotation for debugging purpose. Their presence should thus not block the packing of basic blocks. Fix this by ignoring OP_INLINED_CALL when trying to pack a basic block. Signed-off-by: Luc Van Oostenryck --- flow.c | 1 + validation/call-inlined.c | 4 ---- validation/optim/call-inlined.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 validation/optim/call-inlined.c diff --git a/flow.c b/flow.c index 237c9f1fa..ec7e3f22c 100644 --- a/flow.c +++ b/flow.c @@ -949,6 +949,7 @@ void pack_basic_blocks(struct entrypoint *ep) continue; switch (first->opcode) { case OP_NOP: case OP_LNOP: case OP_SNOP: + case OP_INLINED_CALL: continue; case OP_CBR: case OP_BR: { diff --git a/validation/call-inlined.c b/validation/call-inlined.c index 6fd94edcb..dae68f0e2 100644 --- a/validation/call-inlined.c +++ b/validation/call-inlined.c @@ -27,14 +27,12 @@ foo: add.32 %r3 <- %arg1, %arg2 add.32 %r5 <- %r3, $1 - # call %r5 <- add, %r3, $1 ret.32 %r5 bar: .L3: - # call %r12 <- add, %r10, $1 ret @@ -42,7 +40,6 @@ bas: .L6: add.64 %r16 <- "abc", $1 - # call %r16 <- lstrip, %r14 ret.64 %r16 @@ -50,7 +47,6 @@ qus: .L9: add.64 %r21 <- messg, $1 - # call %r21 <- lstrip, %r19 ret.64 %r21 diff --git a/validation/optim/call-inlined.c b/validation/optim/call-inlined.c new file mode 100644 index 000000000..00698a4b1 --- /dev/null +++ b/validation/optim/call-inlined.c @@ -0,0 +1,30 @@ +static const char messg[] = "def"; + +static inline int add(int a, int b) +{ + return a + b; +} + +int foo(int a, int b, int p) +{ + if (p) { + add(a + b, 1); + return p; + } + return 0; +} + +/* + * check-name: call-inlined + * check-command: test-linearize -Wno-decl $file + * + * check-output-start +foo: +.L0: + + select.32 %r9 <- %arg3, %arg3, $0 + ret.32 %r9 + + + * check-output-end + */