]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Avoid non-returning indirect jumps through $ra [PR110136]
authorLulu Cheng <chenglulu@loongson.cn>
Wed, 7 Jun 2023 02:21:58 +0000 (10:21 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Thu, 15 Jun 2023 08:13:51 +0000 (16:13 +0800)
commit5430c86e71927492399129f3df80824c6c334ddf
tree76afb83a86d19380a7b7f384f139bd19025ee602
parentb992bddac7970b64fe12b07ab3cf47ef4c1f328c
LoongArch: Avoid non-returning indirect jumps through $ra [PR110136]

Micro-architecture unconditionally treats a "jr $ra" as "return from subroutine",
hence doing "jr $ra" would interfere with both subroutine return prediction and
the more general indirect branch prediction.

Therefore, a problem like PR110136 can cause a significant increase in branch error
prediction rate and affect performance. The same problem exists with "indirect_jump".

gcc/ChangeLog:

PR target/110136
* config/loongarch/loongarch.md: Modify the register constraints for template
"jumptable" and "indirect_jump" from "r" to "e".

Co-authored-by: Andrew Pinski <apinski@marvell.com>
gcc/config/loongarch/loongarch.md