From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3AA313858C52; Wed, 18 Oct 2023 23:17:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AA313858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697671078; bh=rezuwlhrOmn8Z9jSAQZsNTkNy25cl62K9A4uAd6x6yk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=A0rlyJHvwYCzmS0JDNKkelofDun6jUqrwmxqdkKqOi7WuNaQyvpgS+ZwH5A5OORgV EUJfuo/uh5g6y//qUDqBom/Z+D6f9PCINbnyP9x/IEQ/mxuEsIVFM5GfYK2mhVckOg JblQy9kSCmA+gzv72phXO4nj8XC1/R34tmy8uAWE= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111791] RISC-V: Strange loop vectorizaion on popcount function Date: Wed, 18 Oct 2023 23:17:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111791 --- Comment #6 from Andrew Pinski --- (In reply to Vineet Gupta from comment #5) > (In reply to Robin Dapp from comment #4) >=20 > > Analyzing loop at pr111791.c:8 > > pr111791.c:8:25: note: =3D=3D=3D analyze_loop_nest =3D=3D=3D > > pr111791.c:8:25: note: =3D=3D=3D vect_analyze_loop_form =3D=3D=3D > > pr111791.c:8:25: note: =3D=3D=3D get_loop_niters =3D=3D=3D > > Matching expression match.pd:1919, generic-match-8.cc:27 > > Applying pattern match.pd:1975, generic-match-2.cc:4670 > > Matching expression match.pd:2707, generic-match-4.cc:36 > > Matching expression match.pd:2710, generic-match-3.cc:53 > > Matching expression match.pd:2717, generic-match-2.cc:23 > > Matching expression match.pd:2707, generic-match-4.cc:36 > > Matching expression match.pd:2710, generic-match-3.cc:53 > > Matching expression match.pd:2717, generic-match-2.cc:23 > > Matching expression match.pd:2707, generic-match-4.cc:36 > > Matching expression match.pd:2710, generic-match-3.cc:53 > > Matching expression match.pd:2717, generic-match-2.cc:23 > > Matching expression match.pd:148, generic-match-10.cc:27 > > Matching expression match.pd:148, generic-match-10.cc:27 > > Applying pattern match.pd:4519, generic-match-4.cc:2923 > > Applying pattern match.pd:201, generic-match-4.cc:3103 > > Applying pattern match.pd:3393, generic-match-2.cc:182 > > pr111791.c:8:25: note: Symbolic number of iterations is (unsigned int= D.4) > > __builtin_popcountlD.1952 (value_4(D)) >=20 > Curious, how did you get this debug output - is this just one of > -fdump-tree-? The `applying pattern`/`matching expression` comes from `-folding` option of `-fdump-tree-`. It is enabled with `-all` at the end too. So in this case it looks like it was: `-fdump-tree-vect-all` since both __builtin_popcount and the type `unsigned int` has the decl ID at the end (that is what `D.4` and `D.1952` are).=