From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AAE6C385801E; Wed, 29 Dec 2021 18:10:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AAE6C385801E From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/103860] [9/10/11/12 Regression] wrong code at -O3 with -fPIC on x86_64-linux-gnu Date: Wed, 29 Dec 2021 18:10:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 9.5 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, 29 Dec 2021 18:10:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103860 --- Comment #3 from Jakub Jelinek --- In the: while (!vec.is_empty () && pro !=3D entry) { while (pro !=3D entry && !can_get_prologue (pro, prologue_clobbered)) { pro =3D get_immediate_dominator (CDI_DOMINATORS, pro); if (bitmap_set_bit (bb_with, pro->index)) vec.quick_push (pro); } basic_block bb =3D vec.pop (); if (!can_dup_for_shrink_wrapping (bb, pro, max_grow_size)) while (!dominated_by_p (CDI_DOMINATORS, bb, pro)) { gcc_assert (pro !=3D entry); pro =3D get_immediate_dominator (CDI_DOMINATORS, pro); if (bitmap_set_bit (bb_with, pro->index)) vec.quick_push (pro); } FOR_EACH_EDGE (e, ei, bb->succs) if (e->dest !=3D EXIT_BLOCK_PTR_FOR_FN (cfun) && bitmap_set_bit (bb_with, e->dest->index)) vec.quick_push (e->dest); } loop, initially we try as pro bb 7 for which can_get_prologue (pro, prologue_clobbered) is true. We iterate for a while, until bb_with is 3, 4, 5, 6, 7, 8, pro still 7, and we pop bb 6, for which can_dup_for_shrink_wrapping is false. vec at this point is empty. As bb 6 isn't dominated by pro 7, we change pro to the immediate dominator of bb 7 which is bb 5, and as it already is = in bb_with bitmap, we don't push anything. bb 6 also has no successors (it tr= aps at the end), so we don't push there anything either. And because vec.is_em= pty () is true, the outer loop doesn't iterate any longer and so nothing checks= if can_get_prologue (pro, prologue_clobbered) (which is false for bb 5).=