From patchwork Wed Nov 15 12:11:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 165321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2492060vqg; Wed, 15 Nov 2023 04:12:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHH8McNZqBYOSKt53Rra1ivPQ4GrSywRK0y5peeKQ/0SC5irsllbhsTSKRR2N/5MkzfX9t+ X-Received: by 2002:a05:620a:46ac:b0:774:267d:4252 with SMTP id bq44-20020a05620a46ac00b00774267d4252mr8673509qkb.15.1700050324514; Wed, 15 Nov 2023 04:12:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700050324; cv=pass; d=google.com; s=arc-20160816; b=z+my0u3xgZJ11fmcJexi1Vs3yZ3C1FNvofTaacg+tYLu7Oo5a6fmkotoWiZY0zmtx1 qwwh/HWc6UX36NtuMYL3GljB28eDvTYQZeUNPUYDey7SmJI04uAyPNAdt7x/r+lSuIWT Qdiv4pspyH/t8BzlIEFDCS/bYRTyaJjMpJFe++hkDZsrkdnSGcB3HUAOOXUxXki6zJNg SGQgGZm1rlirJs3mB8DvfGGi7hCr1O2BwipykcjrGjlrcVDyBuNkldBnhyXuGOqxxTC1 NxioUBfW2wYo3zvxdHCTzDiwrTThF1Oag05BEi0QZNlTw4LxFIASTYSDSX+ERhr1Pgf9 uwlg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:errors-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :user-agent:subject:to:from:date:dkim-signature:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=gry0QI2JeV51NUdtLA3dS4MoBsmnzlj23DUreZoq4V0=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=nwaClUrFu+dZCbNal8L7DcHHiAhbYiNhDtkWiIOowtAB42d/bl7hZSizz4QW+mxrxv ZwC/btvBs1q9L5P3593RNxC9Wn4sXTc2qOrYbbNK6RcB65YTUsMt8wyCLV8MkmdYDQxJ GlWld2zcYYjYtegPul09q81Mbkh3hxLj3bxuaPTUgirGMUcAjEkNIw5RHnYTGzGoNhtg g5IMVbXNXdKZ/XkwyMl2GOFlmtynK4IubSWVw/371GrIPM3QUnNcU8QesXP3CrwibgJ3 N+arynUrnDuN+mu63dX1J1TnWBTI86ofMSIwkGhBq47BFjsbg3SZuXuGjF7gG+eFrYVX +frA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=d8AbRahA; dkim=neutral (no key) header.i=@suse.de; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h24-20020a05620a21d800b0076eeeaaa07asi8682308qka.492.2023.11.15.04.12.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 04:12:04 -0800 (PST) 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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=d8AbRahA; dkim=neutral (no key) header.i=@suse.de; arc=pass (i=1); 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B4C5385C410 for ; Wed, 15 Nov 2023 12:12:04 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 89F293858C41 for ; Wed, 15 Nov 2023 12:11:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 89F293858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 89F293858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.220.28 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700050298; cv=none; b=GokJXZ4tkNLSiFUHhJZz+WwMpLiWgEdXSxq2KEyTPNStPsIC9EBfl4HK1nyx6MHCklgpuhp9GLZqTbL9Eyd71PvFgS1X6gcOnmK4mUk+tNBttd21eQRwCBOPUczWeYUJb1Kc2PlbFAeq+Ik/FaWBM4GndqEVggDC2MSWUYC+pzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700050298; c=relaxed/simple; bh=WVgMzmc1qTAk0kW9rZOz7oc+KJSnsdPACMPuJL45wys=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:MIME-Version; b=MA8mvVqSz/zAla5avEnp/mSgFtaXJ6IiGkYXbiK00wdKAQjdCRR+01fbPywzNJiAZ1A99DITl8pAwtMDi20w6xebdmrHaBifl5BTfcxsWcxvEoDq4gZgRWztw+1PQhh+84KzcccClswAfXfk6wJpbHR5dUq5ZY5Uc28QySwSarc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 11F722199D for ; Wed, 15 Nov 2023 12:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1700050296; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=gry0QI2JeV51NUdtLA3dS4MoBsmnzlj23DUreZoq4V0=; b=d8AbRahAsBaB0gZxI2Fq3JVTCa0H7qSKi6pp1xnbQ23nGFLznOJYsvVws4yK4ZwDag8F1Y dr/ogyIWRzNIAV+PtWNvniNg2T3wA7MVrHTgFKbVw8879yNN/KKB3WC07lVJjSjzdjiStQ lJBwNmIQMutlLMj4Fe/kaY7KZxPV4C8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1700050296; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=gry0QI2JeV51NUdtLA3dS4MoBsmnzlj23DUreZoq4V0=; b=GPnJc/3PusvGI4hrs12QNVEciENeYUkNyiPP7Czu8oH/+/GLykOchrwa8sKyWdPuDwtJO/ 1TjGjlnsPogcLUAA== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id EA9522C699 for ; Wed, 15 Nov 2023 12:11:35 +0000 (UTC) Date: Wed, 15 Nov 2023 12:11:35 +0000 (UTC) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ICE with SLP and -fdbg-cnt User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Level: X-Spamd-Bar: / Authentication-Results: smtp-out1.suse.de; dkim=none; dmarc=none; spf=softfail (smtp-out1.suse.de: 149.44.160.134 is neither permitted nor denied by domain of rguenther@suse.de) smtp.mailfrom=rguenther@suse.de X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [-0.01 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[149.44.160.134:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gcc-patches@gcc.gnu.org]; TO_DN_NONE(0.00)[]; R_SPF_SOFTFAIL(0.60)[~all:c]; RCPT_COUNT_ONE(0.00)[1]; MISSING_MID(2.50)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MX_GOOD(-0.01)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_NA(0.20)[suse.de]; VIOLATED_DIRECT_SPF(3.50)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.20)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; BAYES_HAM(-3.00)[100.00%] X-Spam-Score: -0.01 X-Rspamd-Queue-Id: 11F722199D X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Message-Id: <20231115121204.1B4C5385C410@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782631968747655497 X-GMAIL-MSGID: 1782631968747655497 We have to clear the visited flag on stmts. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-vect-slp.cc (vect_slp_region): Also clear visited flag when we skipped an instance due to -fdbg-cnt. --- gcc/tree-vect-slp.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 80e279d8f50..33c4d1308f6 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -7652,6 +7652,7 @@ vect_slp_region (vec bbs, vec datarefs, bb_vinfo->shared->check_datarefs (); + bool force_clear = false; auto_vec profitable_subgraphs; for (slp_instance instance : BB_VINFO_SLP_INSTANCES (bb_vinfo)) { @@ -7674,15 +7675,17 @@ vect_slp_region (vec bbs, vec datarefs, vect_location = saved_vect_location; if (!dbg_cnt (vect_slp)) - continue; + { + force_clear = true; + continue; + } profitable_subgraphs.safe_push (instance); } /* When we're vectorizing an if-converted loop body make sure we vectorized all if-converted code. */ - if (!profitable_subgraphs.is_empty () - && orig_loop) + if ((!profitable_subgraphs.is_empty () || force_clear) && orig_loop) { gcc_assert (bb_vinfo->bbs.length () == 1); for (gimple_stmt_iterator gsi = gsi_start_bb (bb_vinfo->bbs[0]);