public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions
@ 2021-04-09 10:13 acoplan at gcc dot gnu.org
2021-04-09 10:23 ` [Bug target/99988] " acoplan at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-09 10:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
Bug ID: 99988
Summary: aarch64: GCC generates excessive consecutive bti j
instructions
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
Created attachment 50535
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50535&action=edit
minimal reproducer
For the attached testcase (reduced from the linux kernel), GCC generates
multiple redundant sequences of back-to-back bti j instructions, the longest of
which is 262 instructions long.
To reproduce:
$ aarch64-linux-gnu-gcc -c test.c -S -o - -O2 -mbranch-protection=standard |
uniq -c | grep "bti j" | sort -nr
262 hint 36 // bti j
7 hint 36 // bti j
6 hint 36 // bti j
4 hint 36 // bti j
4 hint 36 // bti j
3 hint 36 // bti j
2 hint 36 // bti j
2 hint 36 // bti j
2 hint 36 // bti j
2 hint 36 // bti j
2 hint 36 // bti j
2 hint 36 // bti j
2 hint 36 // bti j
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
@ 2021-04-09 10:23 ` acoplan at gcc dot gnu.org
2021-04-09 11:29 ` acoplan at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-09 10:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
Alex Coplan <acoplan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.3.1, 9.3.1
--- Comment #1 from Alex Coplan <acoplan at gcc dot gnu.org> ---
GCC 10 and 9 are also affected.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
2021-04-09 10:23 ` [Bug target/99988] " acoplan at gcc dot gnu.org
@ 2021-04-09 11:29 ` acoplan at gcc dot gnu.org
2021-04-21 13:42 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-09 11:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
Alex Coplan <acoplan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |acoplan at gcc dot gnu.org
Last reconfirmed| |2021-04-09
--- Comment #2 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Taking a look at this.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
2021-04-09 10:23 ` [Bug target/99988] " acoplan at gcc dot gnu.org
2021-04-09 11:29 ` acoplan at gcc dot gnu.org
@ 2021-04-21 13:42 ` cvs-commit at gcc dot gnu.org
2021-04-21 13:46 ` acoplan at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-21 13:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alex Coplan <acoplan@gcc.gnu.org>:
https://gcc.gnu.org/g:fe11882ae34c49f6214f93867783ed1332f35f0f
commit r12-34-gfe11882ae34c49f6214f93867783ed1332f35f0f
Author: Alex Coplan <alex.coplan@arm.com>
Date: Wed Apr 21 14:42:04 2021 +0100
aarch64: Avoid duplicating bti j insns for jump tables [PR99988]
This patch fixes PR99988 which shows us generating large (> 250)
sequences of back-to-back bti j instructions.
The fix is simply to avoid inserting bti j instructions at the target of
a jump table if we've already inserted one for a given label.
gcc/ChangeLog:
PR target/99988
* config/aarch64/aarch64-bti-insert.c (aarch64_bti_j_insn_p): New.
(rest_of_insert_bti): Avoid inserting duplicate bti j insns for
jump table targets.
gcc/testsuite/ChangeLog:
PR target/99988
* gcc.target/aarch64/pr99988.c: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
` (2 preceding siblings ...)
2021-04-21 13:42 ` cvs-commit at gcc dot gnu.org
@ 2021-04-21 13:46 ` acoplan at gcc dot gnu.org
2021-04-22 12:46 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-04-21 13:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
--- Comment #4 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Fixed on trunk. Keeping open for backports (once it's had some decent baking
time).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
` (3 preceding siblings ...)
2021-04-21 13:46 ` acoplan at gcc dot gnu.org
@ 2021-04-22 12:46 ` cvs-commit at gcc dot gnu.org
2021-05-11 15:15 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-22 12:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Christophe Lyon <clyon@gcc.gnu.org>:
https://gcc.gnu.org/g:d44d8ed6b4e6fb2d0cf7566214e2e8281dd44cf0
commit r12-58-gd44d8ed6b4e6fb2d0cf7566214e2e8281dd44cf0
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date: Thu Apr 22 12:43:25 2021 +0000
testsuite/aarch64: Run pr99988.c test under lp64 only
The new test fails with -mabi=ilp32:
sorry, unimplemented: return address signing is only supported for
'-mabi=lp64'
2021-04-22 Christophe Lyon <christophe.lyon@linaro.org>
gcc/testsuite/
PR target/99988
* gcc.target/aarch64/pr99988.c: Skip if not lp64 target.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
` (4 preceding siblings ...)
2021-04-22 12:46 ` cvs-commit at gcc dot gnu.org
@ 2021-05-11 15:15 ` cvs-commit at gcc dot gnu.org
2021-05-12 9:58 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-11 15:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Alex Coplan
<acoplan@gcc.gnu.org>:
https://gcc.gnu.org/g:1011bb8bc67cf34c45a9237d72a801a14ad9ef0f
commit r11-8379-g1011bb8bc67cf34c45a9237d72a801a14ad9ef0f
Author: Alex Coplan <alex.coplan@arm.com>
Date: Wed Apr 21 14:42:04 2021 +0100
aarch64: Avoid duplicating bti j insns for jump tables [PR99988]
This patch fixes PR99988 which shows us generating large (> 250)
sequences of back-to-back bti j instructions.
The fix is simply to avoid inserting bti j instructions at the target of
a jump table if we've already inserted one for a given label.
Co-Authored-By: Christophe Lyon <clyon@gcc.gnu.org>
gcc/ChangeLog:
PR target/99988
* config/aarch64/aarch64-bti-insert.c (aarch64_bti_j_insn_p): New.
(rest_of_insert_bti): Avoid inserting duplicate bti j insns for
jump table targets.
gcc/testsuite/ChangeLog:
PR target/99988
* gcc.target/aarch64/pr99988.c: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
` (5 preceding siblings ...)
2021-05-11 15:15 ` cvs-commit at gcc dot gnu.org
@ 2021-05-12 9:58 ` cvs-commit at gcc dot gnu.org
2021-05-12 15:03 ` cvs-commit at gcc dot gnu.org
2021-05-12 15:08 ` acoplan at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-12 9:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Alex Coplan
<acoplan@gcc.gnu.org>:
https://gcc.gnu.org/g:419c243dfb9aba51aceb1370a241db082847eeb5
commit r10-9818-g419c243dfb9aba51aceb1370a241db082847eeb5
Author: Alex Coplan <alex.coplan@arm.com>
Date: Wed Apr 21 14:42:04 2021 +0100
aarch64: Avoid duplicating bti j insns for jump tables [PR99988]
This patch fixes PR99988 which shows us generating large (> 250)
sequences of back-to-back bti j instructions.
The fix is simply to avoid inserting bti j instructions at the target of
a jump table if we've already inserted one for a given label.
Co-Authored-By: Christophe Lyon <clyon@gcc.gnu.org>
gcc/ChangeLog:
PR target/99988
* config/aarch64/aarch64-bti-insert.c (aarch64_bti_j_insn_p): New.
(rest_of_insert_bti): Avoid inserting duplicate bti j insns for
jump table targets.
gcc/testsuite/ChangeLog:
PR target/99988
* gcc.target/aarch64/pr99988.c: New test.
(cherry picked from commit 1011bb8bc67cf34c45a9237d72a801a14ad9ef0f)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
` (6 preceding siblings ...)
2021-05-12 9:58 ` cvs-commit at gcc dot gnu.org
@ 2021-05-12 15:03 ` cvs-commit at gcc dot gnu.org
2021-05-12 15:08 ` acoplan at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-12 15:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Alex Coplan
<acoplan@gcc.gnu.org>:
https://gcc.gnu.org/g:52a09050fdfafb0e41d56b6adf1625264f315b82
commit r9-9528-g52a09050fdfafb0e41d56b6adf1625264f315b82
Author: Alex Coplan <alex.coplan@arm.com>
Date: Wed Apr 21 14:42:04 2021 +0100
aarch64: Avoid duplicating bti j insns for jump tables [PR99988]
This patch fixes PR99988 which shows us generating large (> 250)
sequences of back-to-back bti j instructions.
The fix is simply to avoid inserting bti j instructions at the target of
a jump table if we've already inserted one for a given label.
Co-Authored-By: Christophe Lyon <clyon@gcc.gnu.org>
gcc/ChangeLog:
PR target/99988
* config/aarch64/aarch64-bti-insert.c (aarch64_bti_j_insn_p): New.
(rest_of_insert_bti): Avoid inserting duplicate bti j insns for
jump table targets.
gcc/testsuite/ChangeLog:
PR target/99988
* gcc.target/aarch64/pr99988.c: New test.
(cherry picked from commit 1011bb8bc67cf34c45a9237d72a801a14ad9ef0f)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
` (7 preceding siblings ...)
2021-05-12 15:03 ` cvs-commit at gcc dot gnu.org
@ 2021-05-12 15:08 ` acoplan at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-05-12 15:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988
Alex Coplan <acoplan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #9 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Fixed everywhere.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-05-12 15:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 10:13 [Bug target/99988] New: aarch64: GCC generates excessive consecutive bti j instructions acoplan at gcc dot gnu.org
2021-04-09 10:23 ` [Bug target/99988] " acoplan at gcc dot gnu.org
2021-04-09 11:29 ` acoplan at gcc dot gnu.org
2021-04-21 13:42 ` cvs-commit at gcc dot gnu.org
2021-04-21 13:46 ` acoplan at gcc dot gnu.org
2021-04-22 12:46 ` cvs-commit at gcc dot gnu.org
2021-05-11 15:15 ` cvs-commit at gcc dot gnu.org
2021-05-12 9:58 ` cvs-commit at gcc dot gnu.org
2021-05-12 15:03 ` cvs-commit at gcc dot gnu.org
2021-05-12 15:08 ` acoplan at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).