From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A26E73858297; Wed, 21 Sep 2022 08:11:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A26E73858297 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663747911; bh=DZkbpyINf+khPhFjXr3/gfbQOfkaRKlmOwgPyB1w0X4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pmp6L0n5vrAq3QaF1pg5hq++deQRrN2HDgE9bOcrfchbLRI1orgsaNWgOv6DDIWhp bpXBjHdTJ6+VwP3vTZf4JY8xeoWjOyiDnKyUGGVMurNkq9ABrfbItDCOZvG/AG8Ltp s5bjXaNNZy/8LI/yNflvF1rHaDnh+KxyRH9at9IE= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106989] GCC fail to vectorize and clang succeed Date: Wed, 21 Sep 2022 08:11:51 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth 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: bug_status everconfirmed cf_reconfirmed_on 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106989 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2022-09-21 CC| |rguenth at gcc dot gnu.org --- Comment #5 from Richard Biener --- (In reply to JuzheZhong from comment #4) > (In reply to Andrew Pinski from comment #3) > > The DSE happens but only at the RTL level .... >=20 > Is it a good idea to do data-ref in DSE and remove the first redundant st= ore? Probably - of course that makes things more expensive. The case at hand can probably be handled by what LIMs mem_refs_may_alias_p does, using get_inner_reference_aff (mem1->mem.ref, &off1, &size1); get_inner_reference_aff (mem2->mem.ref, &off2, &size2); aff_combination_expand (&off1, ttae_cache); aff_combination_expand (&off2, ttae_cache); aff_combination_scale (&off1, -1); aff_combination_add (&off2, &off1); if (aff_comb_cannot_overlap_p (&off2, size1, size2)) return false; but I'm not sure we should add more code doing things like that ... If we think that firing up dataref analysis at the point we discover the possible use is too expensive we could also optimistically queue them and only when we find a killing def (and thus the store would be dead), process the queued uses, checking them if they are really important. But well, maybe just try the simplest approach and measure the compile-time effect. That is, in /* If the statement is a use the store is not dead. */ else if (ref_maybe_used_by_stmt_p (use_stmt, ref)) { /* Handle common cases where we can easily build an ao_ref structure for USE_STMT and in doing so we find that the references hit non-live bytes and thus can be ignored. for a gimple assignment, check dr_may_alias_p after analyzing both stmts (we can of course at least cache the DR for 'stmt'). Guarded with flag_expensive_optimizations (thus -O2+). You also need to then initialize loops and SCEV.=