From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id BC38F3882668 for ; Tue, 18 Jun 2024 12:13:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BC38F3882668 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 BC38F3882668 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718712819; cv=none; b=Iaoj2AczLXUc0EuncC0953CH8T1jM2CWFFq89nX1XiEGKx3BePLVaXuKsla9WzRsJfsIPVPlYx7pT/sq2boPHB7y/J7w+KHNyvlkA6qS2tMeroUSFJp1FjGT60OMq37SvhTp3jIsTJmG0RiOMnBBiKkjPzZ/yIdPUPz0EWd2N4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718712819; c=relaxed/simple; bh=s0DKrgkPGeNSUhCE8SK/N26jPiPNxKoE8JNjoH1LBlU=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version:Message-Id; b=pBw8WDTWFWNu0/6UqpCkgFufvTJFrREot+WUvlhneYWMkNZNCXmHQ2NhIH60JK0JyfD/R4uJ3nyltT/d+uxb802SU3OPszXy015VkimzO8vItjKW6uHb8bRw0yCzhWcYKjDga2iYmqI6OVYL8PBNycyZ3GOSvb+zwDsX9EKBgEY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C50741F458 for ; Tue, 18 Jun 2024 12:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718712816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=IidQ0DUt+JkLpmzjrChqasshuy3QliPVNml37oCDzFk=; b=qhDqGJFIBFr2CNTWu+DVuxCXC75c0t9DaTIAZpSHIUH6fjGsGqhrEu0fskgDaGaSL4K5r1 FVjcOlgafIDyROFth4eZaI6oaBofE8sKFM8DaWUt11OnoOFgVwreatyBXpMv4T7uL5JhvP vLh2R6oCfrEMWqtZcXU8tLirBV0Pf+A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718712816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=IidQ0DUt+JkLpmzjrChqasshuy3QliPVNml37oCDzFk=; b=2gJ4R76Ts7jUfjs01qMiGFP++6RAqN9YrVtLgYlIYCkdEEwNZism3W0ZMYG5b+ZvidHd+C 9Dn4IHRfAk1nDGAQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718712816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=IidQ0DUt+JkLpmzjrChqasshuy3QliPVNml37oCDzFk=; b=qhDqGJFIBFr2CNTWu+DVuxCXC75c0t9DaTIAZpSHIUH6fjGsGqhrEu0fskgDaGaSL4K5r1 FVjcOlgafIDyROFth4eZaI6oaBofE8sKFM8DaWUt11OnoOFgVwreatyBXpMv4T7uL5JhvP vLh2R6oCfrEMWqtZcXU8tLirBV0Pf+A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718712816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=IidQ0DUt+JkLpmzjrChqasshuy3QliPVNml37oCDzFk=; b=2gJ4R76Ts7jUfjs01qMiGFP++6RAqN9YrVtLgYlIYCkdEEwNZism3W0ZMYG5b+ZvidHd+C 9Dn4IHRfAk1nDGAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id AA99013AA0 for ; Tue, 18 Jun 2024 12:13:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id LmiTJ/B5cWZSTQAAD6G6ig (envelope-from ) for ; Tue, 18 Jun 2024 12:13:36 +0000 Date: Tue, 18 Jun 2024 14:13:28 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/115537 - ICE with SLP condition reduction vectorization MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Message-Id: <20240618121336.AA99013AA0@imap1.dmz-prg2.suse.org> X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gcc-patches@gcc.gnu.org]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -4.30 X-Spam-Level: X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 List-Id: The condition rejecting "multiple-type" SLP condition reduction lacks handling EXTRACT_LAST reductions. Bootstrap and regtest in progress on x86_64-unknown-linux-gnu. Richard. PR tree-optimization/115537 * tree-vect-loop.cc (vectorizable_reduction): Also reject SLP condition reductions of EXTRACT_LAST kind when multiple statement copies are involved. * gcc.dg/vect/pr115537.c: New testcase. --- gcc/testsuite/gcc.dg/vect/pr115537.c | 19 +++++++++++++++++++ gcc/tree-vect-loop.cc | 5 +++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr115537.c diff --git a/gcc/testsuite/gcc.dg/vect/pr115537.c b/gcc/testsuite/gcc.dg/vect/pr115537.c new file mode 100644 index 00000000000..99ed467feb8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr115537.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-mcpu=neoverse-n1" { target aarch64*-*-* } } */ + +char *a; +int b; +void c() +{ + int d = 0, e = 0, f; + for (; f; ++f) + if (a[f] == 5) + ; + else if (a[f]) + e = 1; + else + d = 1; + if (d) + if (e) + b = 0; +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 7c79e9da106..eeb75c09e91 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -8083,13 +8083,14 @@ vectorizable_reduction (loop_vec_info loop_vinfo, if ((reduction_type == COND_REDUCTION || reduction_type == INTEGER_INDUC_COND_REDUCTION - || reduction_type == CONST_COND_REDUCTION) + || reduction_type == CONST_COND_REDUCTION + || reduction_type == EXTRACT_LAST_REDUCTION) && slp_node && SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node) > 1) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "multiple types in condition reduction reduction.\n"); + "multiple types in condition reduction.\n"); return false; } -- 2.35.3