From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0E78F3858438; Fri, 17 Sep 2021 08:12:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E78F3858438 From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102383] Missing optimization for PRE after enable O2 vectorization Date: Fri, 17 Sep 2021 08:12:00 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw 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: cc 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: Fri, 17 Sep 2021 08:12:01 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102383 Kewen Lin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |linkw at gcc dot gnu.org --- Comment #4 from Kewen Lin --- (In reply to Richard Biener from comment #2) > The issue is that we tame PRE because it tends to inhibit vectorization. >=20 > /* Inhibit the use of an inserted PHI on a loop header when > the address of the memory reference is a simple induction > variable. In other cases the vectorizer won't do anything > anyway (either it's loop invariant or a complicated > expression). */ > if (sprime > && TREE_CODE (sprime) =3D=3D SSA_NAME > && do_pre > && (flag_tree_loop_vectorize || flag_tree_parallelize_loops > 1) > && loop_outer (b->loop_father) > && has_zero_uses (sprime) > && bitmap_bit_p (inserted_exprs, SSA_NAME_VERSION (sprime)) > && gimple_assign_load_p (stmt)) >=20 > the heuristic would either need to become much more elaborate (do more > checks whether vectorization is likely) or we could make the behavior > depend on the cost model as well, for example exclude very-cheap here. > That might have an influence on the performance benefit seen from > -O2 default vectorization though. >=20 > IIRC we suggested to enable predictive commoning at -O2 but avoid > unroll factors > 1 when it was not explicitely enabled. >=20 Yeah, it's PR100794. I also collected some data for different approaches at that time. Recently I opened another issue PR102054 which is also related = to that we restrict PRE due to loop-vect.=