From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by sourceware.org (Postfix) with ESMTPS id 5CBC23858C83 for ; Wed, 22 Feb 2023 08:20:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5CBC23858C83 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x22b.google.com with SMTP id f16so6875764ljq.10 for ; Wed, 22 Feb 2023 00:20:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Zxvz0w3zTMa0qg4AzM/mwPSMmyF+6C/0vrUw2+UjFf0=; b=Ue42twYVoIHKIRV41mm8SHvQqy6jOAM/uEf65/y+u32LnqSERFi8s6Ij2zseyxeyFv 94NxqGmDOsameIqFfafTwRnDP7fqCSAQQg60mLIY/L97Za7YD3B3Vib+kAM6Vt7AiHN2 9EJVBftSN4m4oy5as9Q1KnCSB7CMTEvpXq2Sgn6S2kiOPwYTu/SBEgG7dyDuPgsmOEfs W8b3NGlDdZRxXJRuR3dQeIOYNLASPPJCtcxf8sJ8TI6jktYFmRWzNPfMPGCpGZMqr5rp KDt1YNXgJHrw7TsNJJJ7BgC42KT4JfMnQrL6NoCpFXwuKljWkda2Q4YWPitpJSXxg8gx hAEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Zxvz0w3zTMa0qg4AzM/mwPSMmyF+6C/0vrUw2+UjFf0=; b=59MOWITok5CT5Pa3xQa2ke50AnIWoE2qy+OTVifncIvBNCpYS8ca3cVpjaQgTvoCDA 2CdwYmJmWJfI8803QzRojtH/Sao7CKvY1iU2f1/7abkwsYnvnIbQyt2YWeqRftjYA9GL /D7IysPMcgw7l4jt10+iEMqfvUB7J+eCyFCu0CRPZ/JGLTcT66udgs2eYNwVMGqSA8ZL Pa/11IOoxsgAM3yhhQnUDL/TssXefpmoc+q+uGCf2LT5bFO/l/OnIFE6OtaA0ycvofMI rj9FS3USEP25PVjEqywTe6UtiZJM30MUkkUASiLw6NvqfyR4J8PrHCbEHuDGHuqCx3zZ 6wNw== X-Gm-Message-State: AO0yUKU97HvL+To/NbHfaDyldWn8CCPBVeLBjeUQBoZgylawo5iASxG/ 3Cnr0CSrWcWp5rBH2Kzw5h0359s8PzDgDbl9S08= X-Google-Smtp-Source: AK7set+jx4b3AEgnzp6GnLaiWQJKFo88a7rvS8z7s95Jg6RDx5JAZEjE3Nm+83cgOGsQ6Yvq1O6LYLrb7e2puK0SVx8= X-Received: by 2002:a2e:b4b6:0:b0:293:4fd1:cbd1 with SMTP id q22-20020a2eb4b6000000b002934fd1cbd1mr2498342ljm.6.1677054026560; Wed, 22 Feb 2023 00:20:26 -0800 (PST) MIME-Version: 1.0 References: <3356a2e0-b402-de07-9374-6e5b5c59a2f2@rivosinc.com> In-Reply-To: <3356a2e0-b402-de07-9374-6e5b5c59a2f2@rivosinc.com> From: Richard Biener Date: Wed, 22 Feb 2023 09:20:13 +0100 Message-ID: Subject: Re: [PATCH] vect: Check that vector factor is a compile-time constant To: Michael Collison , Richard Sandiford Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 List-Id: On Wed, Feb 22, 2023 at 12:03 AM Michael Collison wrote: > > 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? I wonder how you arrive at prologue peeling with a non-constant VF? In any case it would probably be better to use constant_lower_bound (vf) here? Also it looks wrong to apply this limit in case we are using a fully masked main vector loop. But as said, the specific case of non-constant VF and prologue peeling probably wasn't supposed to happen, instead the prologue usually is applied via an offset to a fully masked loop? Richard? Thanks, Richard. > 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(-) > > 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, > wi::to_wide (build_int_cst (type, vf)), > -- > 2.34.1 >