From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DC0DA384A40A; Wed, 10 Mar 2021 10:53:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC0DA384A40A From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99510] [11 Regression] Compile time hog in build_aligned_type since r11-7123-g63538886d1f7fc7c Date: Wed, 10 Mar 2021 10:53:11 +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: 11.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 10:53:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99510 --- Comment #2 from Richard Biener --- Ah, OK. We're having a lot of vector CTORs we "vectorize" with load permutations like { 484 506 } and that runs into the pre-existing issue (there's a PR about this...) that we emit dead vector loads for all of the elements in the group, including gaps. Costing says they're even which possibly makes sense. We do a build_aligned_type for each emitted stmt and for some reason it's quite costly here (well, there's the awkward linear type variant list to walk ...). Caching should be possible but the load vectorization loop is already quite awkward. Meh. The rev. likely triggered this because we didn't cost the scalar root stmt before (the CTOR itself we replace). Doing that made the costing profitable. Having equal scalar and vector load cost makes fixing on the costing side difficult - the vector load should be an epsilon more expensive to avoid these issues. Note for some reason we have gazillion of type variants here. Huh. ~36070 variants per type. Ah. And _that's_ because build_aligned_type does for (t =3D TYPE_MAIN_VARIANT (type); t; t =3D TYPE_NEXT_VARIANT (t)) if (check_aligned_type (t, type, align)) return t; t =3D build_variant_type_copy (type); SET_TYPE_ALIGN (t, align); TYPE_USER_ALIGN (t) =3D 1; ^^^^ and check_aligned_type checks for an exact match TYPE_USER_ALIGN, but of course if 'type' wasn't aligned originally it won't find the created aligned type ... Fixing that fixes the compile-time issue.=