From patchwork Fri Oct 28 13:06:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 12264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp819401wru; Fri, 28 Oct 2022 06:07:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BGBG+t64TvNpPFFWtA2sNZpT+Y53c3T/yYxuHy295CGh7IafdKiCfPhcCLPjjeLk0nK6f X-Received: by 2002:a17:906:fe44:b0:77c:e313:a8e8 with SMTP id wz4-20020a170906fe4400b0077ce313a8e8mr48117802ejb.700.1666962462889; Fri, 28 Oct 2022 06:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666962462; cv=none; d=google.com; s=arc-20160816; b=w341SlAqCyKVTCJeVVFwXVzcpc5XCrTw74hMXdBRMmoDv67gkCH2Ln0QpqVI5JQPyE aHFd4lia+y1Gvx6JPYLb5MVQrgUwk6HGCFWVUfD7sDWXDgfEaatdMmpTRCAM+R6PO2jr XBkf8rfHzdvxiYE5fuqYaoD/BenHmNKI9HctrpG7k4WZEn7dEie3Mjl42mICz/3eYWKA YJ9WnLUsqqHa85WlQy6lBXkL61hFLBWDH2CWM3nqSIKsD3/ioIMtvQ9Tq53JWeoSG4Sy O7ERqYGn/9CZJEfyNW4XwPAGTZTaAzx4f+PVtdptTKgXg2GULc6dKKr6y4OvqJizTn/T O1eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:message-id :mime-version:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=mSVMsaj6JRv255TGuvujSyd/BXFFkGPQpjM24jEIwh0=; b=IPsSPwr0QEa65thtggpgWTRtAbDrznUjCwg9Q2FvxYLQ/NpoQYcrEvxSSNZ2dJLEfR IZphv8wRIsjQX1TifHfSDuKcu7Vbm+nLVZia/4La8tU5IMGLi4+9vvyMXTJb5//qlJZw xzMMjDh3zqFZoKXzYN5/MWh6E5QUBlSwby9wFe4Nq9SJUlZr/emyYwa/h0AKSDGWKKv6 qqftY2jsqrjuuL+TiRF7sEQdhSKrgoZyUftZK8SM9hH3E1GmfwtA255D8rwZgy+gxarw icImmmQJDLXALp8yI/8egVyQnpi76OhYMNO+bSAa+NsZlp2zaEhPSP4IEsPoWq6yR3b/ ha/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kuTYLwp5; 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=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hy23-20020a1709068a7700b007835897050esi3362670ejc.404.2022.10.28.06.07.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 06:07:42 -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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kuTYLwp5; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8ED6E3885538 for ; Fri, 28 Oct 2022 13:07:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8ED6E3885538 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666962436; bh=mSVMsaj6JRv255TGuvujSyd/BXFFkGPQpjM24jEIwh0=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kuTYLwp5K3VCk0BOR5Y7RS3lqi2umaJpbztb87FelODo66B2wQbY00J+4DWnlGWjb e/9RZMwMb1YtTUYNC+0ijyY8EVeVOKPBy8fO425STaJINcKEnslPw2UJ8yNtzeELSw a7tkmjmR6QBRPslLkgdiM8KUD5N0Q7rs8R30+Ngw= 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 [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id B6EE23857417 for ; Fri, 28 Oct 2022 13:06:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6EE23857417 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9035721AC4 for ; Fri, 28 Oct 2022 13:06:29 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7CEC513A6E for ; Fri, 28 Oct 2022 13:06:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 34BgHdXTW2MZCgAAMHmgww (envelope-from ) for ; Fri, 28 Oct 2022 13:06:29 +0000 Date: Fri, 28 Oct 2022 15:06:29 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/107435 - ICE with recurrence vectorization MIME-Version: 1.0 Message-Id: <20221028130629.7CEC513A6E@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 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 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747936831626703523?= X-GMAIL-MSGID: =?utf-8?q?1747936831626703523?= This implements the missed conversion from pointer to integer. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/107435 * tree-vect-loop.cc (vectorizable_recurr): Convert initial value to vector component type. * gcc.dg/torture/pr107435.c: New testcase. --- gcc/testsuite/gcc.dg/torture/pr107435.c | 23 +++++++++++++++++++++++ gcc/tree-vect-loop.cc | 6 ++++++ 2 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr107435.c diff --git a/gcc/testsuite/gcc.dg/torture/pr107435.c b/gcc/testsuite/gcc.dg/torture/pr107435.c new file mode 100644 index 00000000000..10128969191 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr107435.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */ + +struct qlist_head { + struct qlist_head *next; +}; +void +qlist_add (struct qlist_head *new, struct qlist_head *head) +{ + struct qlist_head *prev = head; + new->next = head->next; + prev->next = new; +} +struct { + struct qlist_head queue_link; +} free_list, prealloc[64]; +void +dbpf_open_cache_initialize() +{ + int i = 0; + for (; i < 64; i++) + qlist_add(&prealloc[i].queue_link, &free_list.queue_link); +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index d5c2bff80be..aacbb12580c 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -8469,6 +8469,12 @@ vectorizable_recurr (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, edge pe = loop_preheader_edge (LOOP_VINFO_LOOP (loop_vinfo)); basic_block bb = gimple_bb (phi); tree preheader = PHI_ARG_DEF_FROM_EDGE (phi, pe); + if (!useless_type_conversion_p (TREE_TYPE (vectype), TREE_TYPE (preheader))) + { + gimple_seq stmts = NULL; + preheader = gimple_convert (&stmts, TREE_TYPE (vectype), preheader); + gsi_insert_seq_on_edge_immediate (pe, stmts); + } tree vec_init = build_vector_from_val (vectype, preheader); vec_init = vect_init_vector (loop_vinfo, stmt_info, vec_init, vectype, NULL);