From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C172D385DC1B; Fri, 17 Apr 2020 22:24:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C172D385DC1B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587162281; bh=Loun44Z9cg7EFvPSKVD88UnyWOqdcpnxYfvyJwus53o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=V+NUNQ/t2zGoZ5ErZTYMtGF9rquqHljt51G9Rsn6ggaS2U3D+ZlGloa6hqC6csWks jgU7N/IwaELbD0IP4aVumdtbHmPJnbOspn3GvWMIGc7HpSyHQNV+5dY0/4JSdzJfHc 0Ca84clRvSdG1yJV40sQBpu+i98sFm/c2PbM2H28= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/89355] Unnecessary ENDBR Date: Fri, 17 Apr 2020 22:24:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 9.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit 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.4 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: Fri, 17 Apr 2020 22:24:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D89355 --- Comment #9 from CVS Commits --- The releases/gcc-9 branch has been updated by H.J. Lu : https://gcc.gnu.org/g:4a745938b56da04ed01055d5bcb520dc1c760414 commit r9-8508-g4a745938b56da04ed01055d5bcb520dc1c760414 Author: H.J. Lu Date: Fri Apr 17 15:23:27 2020 -0700 x86: Insert ENDBR if function will be called indirectly Since constant_call_address_operand has ;; Test for a pc-relative call operand (define_predicate "constant_call_address_operand" (match_code "symbol_ref") { if (ix86_cmodel =3D=3D CM_LARGE || ix86_cmodel =3D=3D CM_LARGE_PIC || flag_force_indirect_call) return false; if (TARGET_DLLIMPORT_DECL_ATTRIBUTES && SYMBOL_REF_DLLIMPORT_P (op)) return false; return true; }) even if cgraph_node::get (cfun->decl)->only_called_directly_p () returns false, the fuction may still be called indirectly. Copy the logic from constant_call_address_operand to rest_of_insert_endbranch to insert END= BR at function entry if function will be called indirectly. NB: gcc.target/i386/pr94417-2.c is updated to expect 4 ENDBRs, instead of 2, since only GCC 10 has the fix for PR target/89355 not to insert ENDBR after NOTE_INSN_DELETED_LABEL. gcc/ Backport from master PR target/94417 * config/i386/i386.c (rest_of_insert_endbranch): Insert ENDBR at function entry if function will be called indirectly. gcc/testsuite/ Backport from master PR target/94417 * gcc.target/i386/pr94417-1.c: New test. * gcc.target/i386/pr94417-2.c: Likewise. * gcc.target/i386/pr94417-3.c: Likewise. (cherry picked from commit c5f379653964a1d2c7037b2de3e947a48370a198)=