From patchwork Tue Feb 21 23:02:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Collison X-Patchwork-Id: 65439 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 99802385842B for ; Tue, 21 Feb 2023 23:02:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by sourceware.org (Postfix) with ESMTPS id 181ED3858C39 for ; Tue, 21 Feb 2023 23:02:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 181ED3858C39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-qt1-x830.google.com with SMTP id h16so5935235qta.8 for ; Tue, 21 Feb 2023 15:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=rCHgx1CtZWWJq1Qoy4KqEp5rUnMOWRznmFUrxiNZlKI=; b=eUsCCIpYjI0vcs6lFBXZIuxloR+m+C/8hwd0nTcyUS+HmQ+lbMdrxe8bn1l5eDPDIu c1vG/cdL6sH9s4Kmi0IbFQjs0qNXO5NQbWNnk5kRI8CkdJpUSeAvFHk916YylT1W/wCS Kk3EuvR62aGg+WdQJ5pe+xf11aexj2ZDZWUkFTkKg6KIRF1G+lgtg2MjIXOUoUVCCOvJ yyhM46nuozgf+n1adIqDksGqgu9i9RMcltzt3PsPmcNRmeef/biM0h6ng2d+htfkIgDq bDD05ayqUG7Fub5YssMQjwHl/75RoMgqV9jf2lOCnJuplvG+j+cZehcDYhG9mKbPe4X+ WRZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=rCHgx1CtZWWJq1Qoy4KqEp5rUnMOWRznmFUrxiNZlKI=; b=1/eglnxsLF50q1I3NAYDzVrLvPNVAfUWRSgiu1gnhS9Vbxfwe7XHsO+6Z0sDBaGv5a cVZWugz+OMXL+xftD/DhG1Z+yanIorQSGlZE5xp3S2zjIxhMto5y4Mntv22wiO/CQIA4 TO/atN9ZASJSNopTxyl9X4/mfMVH4eqeu2HvGGlsS5amcVndMkBv+L5xOOVIT9Th2Qk4 zn7ufRybm3Td11UCeEm42ofVcrDozNvkOvqROq+UqKdUBmDMFDOhw57cixtVoMRMoruO mCVGlkW3/2ZYAU67cRm/2c9x+2r+xSOivA4piz35elTfABRbUPnrDYppRxQYuohtBJll HKBA== X-Gm-Message-State: AO0yUKUzY2hsFXTcB274eEP55EfBgLVLA6N1f4wVedfZgeK32HoC2vfW 9AOye1d65YGYgDci8qI5UL6Ke+YXhLq1jnmUI4c= X-Google-Smtp-Source: AK7set8Xkrr3lQdHt77CyjHgKICYqvwc5R3SXa31PvkQaMSIMkJblVI7pwr8VPii5Y09LMc87C0oVA== X-Received: by 2002:a05:622a:18d:b0:3b6:3a12:2bf9 with SMTP id s13-20020a05622a018d00b003b63a122bf9mr23762170qtw.2.1677020554250; Tue, 21 Feb 2023 15:02:34 -0800 (PST) Received: from [192.168.86.117] ([136.57.172.92]) by smtp.gmail.com with ESMTPSA id i123-20020a378681000000b0074233b15a72sm430396qkd.116.2023.02.21.15.02.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Feb 2023 15:02:32 -0800 (PST) Message-ID: <3356a2e0-b402-de07-9374-6e5b5c59a2f2@rivosinc.com> Date: Tue, 21 Feb 2023 18:02:32 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-US To: gcc-patches@gcc.gnu.org From: Michael Collison Subject: [PATCH] vect: Check that vector factor is a compile-time constant X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" While working on autovectorizing for the RISCV port I encountered an issue where vect_do_peeling assumes that the vectorization factor is a compile-time constant. The vectorization is not a compile-time constant on RISCV. Tested on RISCV and x86_64-linux-gnu. Okay? Michael gcc/     * tree-vect-loop-manip.cc (vect_do_peeling): Verify     that vectorization factor is a compile-time constant. ---  gcc/tree-vect-loop-manip.cc | 2 +-  1 file changed, 1 insertion(+), 1 deletion(-)                wi::to_wide (build_int_cst (type, vf)), diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 6aa3d2ed0bf..1ad1961c788 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -2930,7 +2930,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,        niters = vect_build_loop_niters (loop_vinfo, &new_var_p);        /* It's guaranteed that vector loop bound before vectorization is at       least VF, so set range information for newly generated var. */ -      if (new_var_p) +      if (new_var_p && vf.is_constant ())      {        value_range vr (type,