aarch64: Avoid duplicating bti j insns for jump tables [PR99988]
authorAlex Coplan <alex.coplan@arm.com>
Wed, 21 Apr 2021 13:42:04 +0000 (14:42 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Wed, 21 Apr 2021 13:42:04 +0000 (14:42 +0100)
commitfe11882ae34c49f6214f93867783ed1332f35f0f
tree390ceccf7db5838289ee1563448e33fc022f5a09
parentca4bf1dd4398dc65d8fff8b9f5c67733729cee95
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.
gcc/config/aarch64/aarch64-bti-insert.c
gcc/testsuite/gcc.target/aarch64/pr99988.c [new file with mode: 0644]