From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BA61384AB6B; Wed, 15 May 2024 08:08:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BA61384AB6B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715760508; bh=/USeJfZ4MYL7Nvo+ML+HhOwyirT0MbYLpJBGtsOa3Ow=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XApTnVG9pgHBfaYn5HqOIdFtkAXDLv9xU4kE2owmJHNM9ol4ImEoQpzRvE8XbQfR2 JR6/NKkhEpYkB74OrEMMp6twWaTwnt6SwggjJuzKgo0deOZGV7w1RZZ31P0NJcFIRh ts3DiV8QSbpgPc4qkHHgWxNOOM1Z7/rbxcI9nDIk= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114301] gimple_can_duplicate_bb_p check for returns twice can be moved to the check of the last statement Date: Wed, 15 May 2024 08:08:27 +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: compile-time-hog, internal-improvement, patch X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia 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=3D114301 --- Comment #3 from GCC Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:642f31d6286b8a342130fbface51530befd975fd commit r15-501-g642f31d6286b8a342130fbface51530befd975fd Author: Andrew Pinski Date: Tue May 14 06:29:18 2024 -0700 tree-cfg: Move the returns_twice check to be last statement only [PR114= 301] When I was checking to making sure that all of the bugs dealing with the case where gimple_can_duplicate_bb_p would return false was fi= xed, I noticed that the code which was checking if a call statement was returns_twice was checking all call statements rather than just the last statement. Since calling gimple_call_flags has a small non-zero overhead due to a few string comparison, removing the uses of it can have a small performance improvement. In the case of returns_twice functions calls, will always end the basic-block due to the check in stmt_can_terminate_bb_p (and others). So checking only the last stateme= nt is a small optimization and will be safe. Bootstrapped and tested pon x86_64-linux-gnu with no regressions. PR tree-optimization/114301 gcc/ChangeLog: * tree-cfg.cc (gimple_can_duplicate_bb_p): Check returns_twice only on the last call statement rather than all. Signed-off-by: Andrew Pinski =