Do not use caller-saved registers for COMDAT functions
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Comments
On 7/15/24 09:04, LIU Hao wrote:
>
> diff --git a/gcc/varasm.cc b/gcc/varasm.cc
> index 747f74ba1c0..b67a0b524db 100644
> --- a/gcc/varasm.cc
> +++ b/gcc/varasm.cc
> @@ -7805,6 +7805,8 @@ decl_binds_to_current_def_p (const_tree decl)
> for all other declaration types. */
> if (DECL_WEAK (decl))
> return false;
> + if (DECL_COMDAT_GROUP (decl))
> + return false;
> if (DECL_COMMON (decl)
> && (DECL_INITIAL (decl) == NULL
> || (!in_lto_p && DECL_INITIAL (decl) == error_mark_node)))
> --
> 2.34.1
Looks ok to me, will push to master branch soon if there are no further
comments.
On 7/15/24 12:45, Jonathan Yong wrote:
> On 7/15/24 09:04, LIU Hao wrote:
>>
>> diff --git a/gcc/varasm.cc b/gcc/varasm.cc
>> index 747f74ba1c0..b67a0b524db 100644
>> --- a/gcc/varasm.cc
>> +++ b/gcc/varasm.cc
>> @@ -7805,6 +7805,8 @@ decl_binds_to_current_def_p (const_tree decl)
>> for all other declaration types. */
>> if (DECL_WEAK (decl))
>> return false;
>> + if (DECL_COMDAT_GROUP (decl))
>> + return false;
>> if (DECL_COMMON (decl)
>> && (DECL_INITIAL (decl) == NULL
>> || (!in_lto_p && DECL_INITIAL (decl) == error_mark_node)))
>> --
>> 2.34.1
>
>
> Looks ok to me, will push to master branch soon if there are no further
> comments.
Thanks, pushed to master branch.
From 6a2f0d3fbd443487bb6dd7bc95ed5403cd572ac1 Mon Sep 17 00:00:00 2001
From: LIU Hao <lh_mouse@126.com>
Date: Mon, 15 Jul 2024 16:55:52 +0800
Subject: [PATCH] Do not use caller-saved registers for COMDAT functions
A reference to a COMDAT function may be resolved to another definition
outside the current translation unit, so it's not eligible for `-fipa-ra`.
In `decl_binds_to_current_def_p()` there is already a check for weak
symbols. This commit checks for COMDAT functions that are not implemented
as weak symbols, for example, on *-*-mingw32.
gcc/ChangeLog:
PR rtl-optimization/115049
* varasm.cc (decl_binds_to_current_def_p): Add a check for COMDAT
declarations too, like weak ones.
---
gcc/varasm.cc | 2 ++
1 file changed, 2 insertions(+)
@@ -7805,6 +7805,8 @@ decl_binds_to_current_def_p (const_tree decl)
for all other declaration types. */
if (DECL_WEAK (decl))
return false;
+ if (DECL_COMDAT_GROUP (decl))
+ return false;
if (DECL_COMMON (decl)
&& (DECL_INITIAL (decl) == NULL
|| (!in_lto_p && DECL_INITIAL (decl) == error_mark_node)))
--
2.34.1