From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id 4BE303858D1E for ; Wed, 17 May 2023 06:32:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4BE303858D1E 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-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4eff4ea8e39so504253e87.1 for ; Tue, 16 May 2023 23:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684305167; x=1686897167; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BSjSDjaxi8RM7aixl0aAV0PBecpaqCI9ZgUjLDs8hHM=; b=P5RG/aIicUC/G3nloRJ50e6Im6Hb1ljaNIC3cjA1pEopGOoJ8TF9LZf0I/CZC37MZP 4tqEt+kIBe0v/vyJaNsJRQXFrOaN9tqIIKJZmisNaodo18NqYARr2gujeoHMc4XlXBN0 c0ZQDSgONOH3RtzZTKRT/MZZPew5/9mFi3ISnTEX79FqSWufVpdVPamDv0B2jM34zTL2 Z7K6HkLhKq8grVrGV0NRMN4KN47gtHBmIwBEatFtPKzLNaSWKbArFZbANirv79mGSr+p bZHzzgncWNqOF9a7WyO6IDJiZKM5XCiH0Cj2xsOWQT9KSkdHVxYlIHSaCpWZqp7QPSjv i+Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684305167; x=1686897167; h=content-transfer-encoding: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=BSjSDjaxi8RM7aixl0aAV0PBecpaqCI9ZgUjLDs8hHM=; b=c1Q4RgdQx6zf+vXVUglRjbqQZUYfwV3/6CH3+pX/WP6a1PG0LF/6YlIhUSbhDkEenJ ZtUTfykyHwQLLyCHj72WXBeRBiXSmRTYmjQAnYyBLV7qKni1qQByB3cqWxTNPh240jqT 5365xUlwTToZAmMJ9le6df4vGaK8O5Jql59Plzyg/v5fcFILdnOct3otO5AvY6/4MfoA 9AiyU8fXEz74st7qzjduBNQ1TotIQ43mbSYgJm64bvJtFnI2qMhTAhIgGCNM54p97Kc2 CyDAuVm7sLeYImM1jv/whIgZ1lVFP2Le6T6idDD0NKUPFQK43nDyMiU7DRekh8uuDvFW 7yGA== X-Gm-Message-State: AC+VfDxoUpKIVJyTI8Fav9KmHuSvYgI3E9XFGub0BX4kYNpFTPbrqBRP 6JENbjhuo8HJOYXLWi2Y+UYjltLYhFBOaa2rWq0Uhb9jpQw= X-Google-Smtp-Source: ACHHUZ5HDZv7FfjceU5bAVmTNkGe8T/JMYM6ouos9BCYQpNdMmhoiD7O4CZfCnCF09pVySYLyars8bcP6nhLzNPefC4= X-Received: by 2002:a05:6512:928:b0:4e8:4489:6f06 with SMTP id f8-20020a056512092800b004e844896f06mr7303086lft.58.1684305166642; Tue, 16 May 2023 23:32:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Wed, 17 May 2023 08:32:34 +0200 Message-ID: Subject: Re: [PATCH] vect: Don't retry if the previous analysis fails To: "Kewen.Lin" Cc: GCC Patches , Richard Sandiford , Segher Boessenkool , Peter Bergner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 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,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: On Wed, May 17, 2023 at 8:06=E2=80=AFAM Kewen.Lin wro= te: > > Hi, > > When working on a cost tweaking patch, I found that a newly > added test case has different dumpings with stage-1 and > bootstrapped gcc. By looking into it, the apparent reason > is vect_analyze_loop_2 doesn't get slp_done_for_suggested_uf > set expectedly, the following retrying will use the garbage > slp_done_for_suggested_uf instead. In fact, the setting of > slp_done_for_suggested_uf only happens when the previous > analysis succeeds, for the mentioned test case, its previous > analysis does fail, it's unexpected to use the value of > slp_done_for_suggested_uf any more. > > In function vect_analyze_loop_1, we only return success when > res is true, which is the result of 1st analysis. It means > we never try to vectorize with unroll_vinfo if the previous > analysis fails. So this patch shouldn't break anything, and > just stop some useless analysis early. > > Bootstrapped and regtested on x86_64-redhat-linux, > aarch64-linux-gnu and powerpc64{,le}-linux-gnu. > > Is it ok for trunk? OK for trunk and affected branches. Richard. > BR, > Kewen > ----- > gcc/ChangeLog: > > * tree-vect-loop.cc (vect_analyze_loop_1): Don't retry analysis w= ith > suggested unroll factor once the previous analysis fails. > --- > gcc/tree-vect-loop.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc > index ed0166fedab..905145ae97b 100644 > --- a/gcc/tree-vect-loop.cc > +++ b/gcc/tree-vect-loop.cc > @@ -3044,7 +3044,7 @@ vect_analyze_loop_1 (class loop *loop, vec_info_sha= red *shared, > res ? "succeeded" : " failed", > GET_MODE_NAME (loop_vinfo->vector_mode)); > > - if (!main_loop_vinfo && suggested_unroll_factor > 1) > + if (res && !main_loop_vinfo && suggested_unroll_factor > 1) > { > if (dump_enabled_p ()) > dump_printf_loc (MSG_NOTE, vect_location, > -- > 2.31.1