From patchwork Mon Aug 28 08:07:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 137012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp3180471vqm; Mon, 28 Aug 2023 01:08:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiqFAAidBBQSgcQ6ZFFo1KM/NhsP5b3d7LzCZf//dchqwVZR6zKILXlGvPmgnO4ClfeTjE X-Received: by 2002:a2e:9946:0:b0:2bc:ee89:6976 with SMTP id r6-20020a2e9946000000b002bcee896976mr7118209ljj.24.1693210126633; Mon, 28 Aug 2023 01:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693210126; cv=none; d=google.com; s=arc-20160816; b=ASopBTE2XVTI/R1C35P71Mpm+w6pmmkHlUF4ie9OKxJOeMOL+6vR/klk8yNjUzWuhO Ms9CXAJ+mtPVhqA5a36XrJWXlUxc6Wnuhe8yByvpE+peJKg+AST83AaaN/WNVuRMXLgK 8/ENTTmoloXStHzxjeQO0lgLQ/eWlT26EhemL6FphwpNsCOEmUClYVQdurjCv3IkwPXY 0eFzIsvOQOyuPRbBaOba5aaQkFWZ8XmzeIGfszoFKz7mb+jkkVan+7VqHndJB/pyEO1A TxOA7pUdsJzxsc9ZHHraGiBMjKHplVRj10uErRiHDNq0XbFXxGx8rbBHykElNLXQZlXi +9Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:to :from:dmarc-filter:delivered-to; bh=aelGMbZvbRzaruB5u1XlJNYECLBkRUgl5nMNuNcovq8=; fh=arl273cIQBNH1P6XLxHQvF0scgitfd773vOV+bwQx3o=; b=PTcjbMQIz1qfhZqIXDy/YpSP+Apb+S4Eab/MMEyjml3CgHYeMbPAcR/Zcp0MJO6Jyy qEDdwEp9FfgjE3FxEYE1ckPQuDA3LPOvpgG24qbdFGg4ZrQ/a9zWysWeIiENSdm4X+p0 is4wOTswfDOjkIhb3LvUa0U3cs0vTJRZhC9AGlJ//9orRr3fCVTEVPCP6Y8y415lQppF 3TbRlH33sPAEfYVBjZ0deYrUQcsg3xcPsducC5w3ifxW5a7aF1Iy3M+wT3od2r+65cXo CGxOJpLUtH4D+4AOFdRVm26W6tedLtlzso9o4oxXTqZk2TAo8pYIF/bQGMNdNGVhZBLu kRZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id p23-20020a170906839700b0098804fbcff0si4095763ejx.709.2023.08.28.01.08.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 01:08:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A5DC43858288 for ; Mon, 28 Aug 2023 08:08:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbg150.qq.com (smtpbg150.qq.com [18.132.163.193]) by sourceware.org (Postfix) with ESMTPS id A17B43858D28 for ; Mon, 28 Aug 2023 08:08:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A17B43858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp70t1693210072tef1fouo Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 28 Aug 2023 16:07:50 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: znfcQSa1hKZkCmdF5tCleCHTm4AqajJAZe9dkIbqjPa8+9YmLdSlsDDSH4QwL ArM6KTyhbIEWnYE3Nybld8OdHxRGDUK6JE3oE/KzBkAicuSMM1GiOR1P1jLKD3KCwRcf/oh xs+hxDo8Y39RYrQ+UCzdg5Bq5ZayzDvYhSXfKTZbEiMehQRsWkVXEXtvuzq4GSQ3vP+8iZm OchXEtw3h0JyctGBk38XEjS2fX4bwVneqaQvsHOU7QQcR9V9d8muvAVP7rcvS+VNJEtSIlr krHZT5/ZJHinCUN5823OZuB/YQbKaIgKkpUp2r7qnG8BTNVRQBLoWPI2enHWqkfgU0D/z6g xcRm1O8qlQrmTlQHzx4/596lPv2hClV6Cm5poZuCCZUgzb8LOOpDCXe+lrqnyNMkx8xhRae r7bjtBq9nb8= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 15570364609596763025 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Subject: [PATCH] RISC-V: Disable user vsetvl fusion into EMPTY block Date: Mon, 28 Aug 2023 16:07:49 +0800 Message-Id: <20230828080749.2064182-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kito.cheng@sifive.com, kito.cheng@gmail.com, Juzhe-Zhong Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775459501588069734 X-GMAIL-MSGID: 1775459501588069734 This patch is fixing these bunch of ICE in "vect" testsuite: FAIL: gcc.dg/vect/no-scevccp-outer-2.c (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/no-scevccp-outer-2.c (test for excess errors) FAIL: gcc.dg/vect/pr109025.c (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/pr109025.c (test for excess errors) FAIL: gcc.dg/vect/pr109025.c -flto -ffat-lto-objects (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/pr109025.c -flto -ffat-lto-objects (test for excess errors) FAIL: gcc.dg/vect/pr42604.c (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/pr42604.c (test for excess errors) FAIL: gcc.dg/vect/pr42604.c -flto -ffat-lto-objects (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/pr42604.c -flto -ffat-lto-objects (test for excess errors) FAIL: gcc.dg/vect/vect-double-reduc-3.c (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/vect-double-reduc-3.c (test for excess errors) FAIL: gcc.dg/vect/vect-double-reduc-3.c -flto -ffat-lto-objects (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/vect-double-reduc-3.c -flto -ffat-lto-objects (test for excess errors) FAIL: gcc.dg/vect/vect-double-reduc-7.c (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/vect-double-reduc-7.c (test for excess errors) FAIL: gcc.dg/vect/vect-double-reduc-7.c -flto -ffat-lto-objects (internal compiler error: in anticipatable_occurrence_p, at config/riscv/riscv-vsetvl.cc:314) FAIL: gcc.dg/vect/vect-double-reduc-7.c -flto -ffat-lto-objects (test for excess errors) gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (pass_vsetvl::earliest_fusion): Disable user vsetvl fusion into EMPTY block. --- gcc/config/riscv/riscv-vsetvl.cc | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 682f795c8e1..984252f8fe3 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -3290,6 +3290,24 @@ pass_vsetvl::earliest_fusion (void) { if (src_block_info.probability == profile_probability::uninitialized () + /* We don't do fusion across BBs for user explicit + vsetvl instruction for these following reasons: + + - The user vsetvl instruction is configured as + no side effects that the previous passes + (GSCE, Loop-invariant, ..., etc) + should be able to do a good job on optimization + of user explicit vsetvls so we don't need to + PRE optimization (The user vsetvls should be + on the optimal local already before this pass) + again for user vsetvls in VSETVL PASS here + (Phase 3 && Phase 4). + + - Allowing user vsetvls be optimized in PRE + optimization here (Phase 3 && Phase 4) will + complicate the codes so much so we prefer user + vsetvls be optimized in post-optimization + (Phase 5 && Phase 6). */ || vsetvl_insn_p (expr.get_insn ()->rtl ())) continue; new_info = expr.global_merge (expr, eg->src->index); @@ -3317,6 +3335,25 @@ pass_vsetvl::earliest_fusion (void) prob = profile_probability::uninitialized (); } else if (!src_block_info.reaching_out.compatible_p (expr) + /* We don't do fusion across BBs for user explicit + vsetvl instruction for these following reasons: + + - The user vsetvl instruction is configured as + no side effects that the previous passes + (GSCE, Loop-invariant, ..., etc) + should be able to do a good job on optimization + of user explicit vsetvls so we don't need to + PRE optimization (The user vsetvls should be + on the optimal local already before this pass) + again for user vsetvls in VSETVL PASS here + (Phase 3 && Phase 4). + + - Allowing user vsetvls be optimized in PRE + optimization here (Phase 3 && Phase 4) will + complicate the codes so much so we prefer user + vsetvls be optimized in post-optimization + (Phase 5 && Phase 6). */ + && !vsetvl_insn_p (expr.get_insn ()->rtl ()) && dest_block_info.probability > src_block_info.probability) {