diff options
author | Yangyu Chen <cyy@cyyself.name> | 2024-10-24 15:12:45 +0800 |
---|---|---|
committer | Kito Cheng <kito.cheng@sifive.com> | 2024-10-31 18:37:51 +0800 |
commit | eb828a1e380e7bb5a708c899081541ee9130ff87 (patch) | |
tree | 2e3c93dcc48f6e548e795b4dd18720f14c823a17 | |
parent | f011f8908182fd05ddd9a34881507b8584c44fb2 (diff) | |
download | gcc-eb828a1e380e7bb5a708c899081541ee9130ff87.zip gcc-eb828a1e380e7bb5a708c899081541ee9130ff87.tar.gz gcc-eb828a1e380e7bb5a708c899081541ee9130ff87.tar.bz2 |
RISC-V: Do not inline when callee is versioned but caller is not
When the callee is versioned but the caller is not, we should not inline
the callee into the caller, to prevent the default version of the callee
from being inlined into a not versioned caller.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_can_inline_p): Refuse to inline
when callee is versioned but caller is not.
-rw-r--r-- | gcc/config/riscv/riscv.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 8443b29..0b3b2c4 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -7693,6 +7693,10 @@ riscv_compute_frame_info (void) static bool riscv_can_inline_p (tree caller, tree callee) { + /* Do not inline when callee is versioned but caller is not. */ + if (DECL_FUNCTION_VERSIONED (callee) && ! DECL_FUNCTION_VERSIONED (caller)) + return false; + tree callee_tree = DECL_FUNCTION_SPECIFIC_TARGET (callee); tree caller_tree = DECL_FUNCTION_SPECIFIC_TARGET (caller); |