* [GOOGLE] Fix the bug where implicit section names prevents function splitting
@ 2014-08-14 4:03 Yi Yang
2014-08-14 18:25 ` Teresa Johnson
0 siblings, 1 reply; 5+ messages in thread
From: Yi Yang @ 2014-08-14 4:03 UTC (permalink / raw)
To: GCC Patches; +Cc: Dehao Chen, Teresa Johnson
This bug is caused by my last patch, which did not differentiate
between explicit section names (via attributes) and implicit section
names (via -ffunction-section).
This patch fixes that.
--
diff --git gcc/bb-reorder.c gcc/bb-reorder.c
index 8f8c420..2115b01 100644
--- gcc/bb-reorder.c
+++ gcc/bb-reorder.c
@@ -2505,7 +2505,7 @@ gate_handle_partition_blocks (void)
we are going to omit the reordering. */
&& optimize_function_for_speed_p (cfun)
&& !DECL_ONE_ONLY (current_function_decl)
- && !DECL_SECTION_NAME (current_function_decl));
+ && !DECL_HAS_EXPLICIT_SECTION_NAME_P(current_function_decl));
}
/* This function is the main 'entrance' for the optimization that
diff --git gcc/tree.h gcc/tree.h
index 817507f..738675a 100644
--- gcc/tree.h
+++ gcc/tree.h
@@ -3201,6 +3201,11 @@ struct GTY(()) tree_parm_decl {
#define DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE) \
(DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.implicit_section_name_p)
+/* Speficy whether the section name was explicitly set with decl_attributes. */
+#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
+ (DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE)? false: \
+ !!DECL_SECTION_NAME(NODE))
+
struct GTY(()) tree_decl_with_vis {
struct tree_decl_with_rtl common;
tree assembler_name;
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GOOGLE] Fix the bug where implicit section names prevents function splitting
2014-08-14 4:03 [GOOGLE] Fix the bug where implicit section names prevents function splitting Yi Yang
@ 2014-08-14 18:25 ` Teresa Johnson
2014-08-14 20:46 ` Yi Yang
0 siblings, 1 reply; 5+ messages in thread
From: Teresa Johnson @ 2014-08-14 18:25 UTC (permalink / raw)
To: Yi Yang; +Cc: GCC Patches, Dehao Chen
On Wed, Aug 13, 2014 at 9:03 PM, Yi Yang <ahyangyi@google.com> wrote:
> This bug is caused by my last patch, which did not differentiate
> between explicit section names (via attributes) and implicit section
> names (via -ffunction-section).
>
> This patch fixes that.
>
> --
>
> diff --git gcc/bb-reorder.c gcc/bb-reorder.c
> index 8f8c420..2115b01 100644
> --- gcc/bb-reorder.c
> +++ gcc/bb-reorder.c
> @@ -2505,7 +2505,7 @@ gate_handle_partition_blocks (void)
> we are going to omit the reordering. */
> && optimize_function_for_speed_p (cfun)
> && !DECL_ONE_ONLY (current_function_decl)
> - && !DECL_SECTION_NAME (current_function_decl));
> + && !DECL_HAS_EXPLICIT_SECTION_NAME_P(current_function_decl));
> }
>
> /* This function is the main 'entrance' for the optimization that
> diff --git gcc/tree.h gcc/tree.h
> index 817507f..738675a 100644
> --- gcc/tree.h
> +++ gcc/tree.h
> @@ -3201,6 +3201,11 @@ struct GTY(()) tree_parm_decl {
> #define DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE) \
> (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.implicit_section_name_p)
>
> +/* Speficy whether the section name was explicitly set with decl_attributes. */
> +#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
> + (DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE)? false: \
> + !!DECL_SECTION_NAME(NODE))
Personally, I think it is clearer to simply write this as:
#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
(DECL_SECTION_NAME(NODE) != NULL_TREE \
&& !DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE))
Teresa
> +
> struct GTY(()) tree_decl_with_vis {
> struct tree_decl_with_rtl common;
> tree assembler_name;
> --
--
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GOOGLE] Fix the bug where implicit section names prevents function splitting
2014-08-14 18:25 ` Teresa Johnson
@ 2014-08-14 20:46 ` Yi Yang
2014-08-14 20:49 ` Teresa Johnson
0 siblings, 1 reply; 5+ messages in thread
From: Yi Yang @ 2014-08-14 20:46 UTC (permalink / raw)
To: Teresa Johnson; +Cc: GCC Patches, Dehao Chen
Patch v2.
Trunk no longer set SECTION_NAME for implicit section names, so this
probably does not apply to trunk. It's probably not necessary for
trunk either.
Tested for Google 4.8(albeit unnecessary) and 4.9 branch.
diff --git gcc/bb-reorder.c gcc/bb-reorder.c
index a1b3e65..b9a829e 100644
--- gcc/bb-reorder.c
+++ gcc/bb-reorder.c
@@ -2554,7 +2554,7 @@ gate_handle_partition_blocks (void)
we are going to omit the reordering. */
&& optimize_function_for_speed_p (cfun)
&& !DECL_ONE_ONLY (current_function_decl)
- && !DECL_SECTION_NAME (current_function_decl));
+ && !DECL_HAS_EXPLICIT_SECTION_NAME_P(current_function_decl));
}
/* This function is the main 'entrance' for the optimization that
diff --git gcc/tree.h gcc/tree.h
index b656b7b..308eef8 100644
--- gcc/tree.h
+++ gcc/tree.h
@@ -2405,6 +2405,11 @@ extern void decl_value_expr_insert (tree, tree);
#define DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE) \
(DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.implicit_section_name_p)
+/* Speficy whether the section name was explicitly set with decl_attributes. */
+#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
+ (DECL_SECTION_NAME(NODE) != NULL_TREE \
+ && !DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE))
+
extern tree decl_debug_expr_lookup (tree);
extern void decl_debug_expr_insert (tree, tree);
--
On Thu, Aug 14, 2014 at 11:25 AM, Teresa Johnson <tejohnson@google.com> wrote:
> On Wed, Aug 13, 2014 at 9:03 PM, Yi Yang <ahyangyi@google.com> wrote:
>> This bug is caused by my last patch, which did not differentiate
>> between explicit section names (via attributes) and implicit section
>> names (via -ffunction-section).
>>
>> This patch fixes that.
>>
>> --
>>
>> diff --git gcc/bb-reorder.c gcc/bb-reorder.c
>> index 8f8c420..2115b01 100644
>> --- gcc/bb-reorder.c
>> +++ gcc/bb-reorder.c
>> @@ -2505,7 +2505,7 @@ gate_handle_partition_blocks (void)
>> we are going to omit the reordering. */
>> && optimize_function_for_speed_p (cfun)
>> && !DECL_ONE_ONLY (current_function_decl)
>> - && !DECL_SECTION_NAME (current_function_decl));
>> + && !DECL_HAS_EXPLICIT_SECTION_NAME_P(current_function_decl));
>> }
>>
>> /* This function is the main 'entrance' for the optimization that
>> diff --git gcc/tree.h gcc/tree.h
>> index 817507f..738675a 100644
>> --- gcc/tree.h
>> +++ gcc/tree.h
>> @@ -3201,6 +3201,11 @@ struct GTY(()) tree_parm_decl {
>> #define DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE) \
>> (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.implicit_section_name_p)
>>
>> +/* Speficy whether the section name was explicitly set with decl_attributes. */
>> +#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
>> + (DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE)? false: \
>> + !!DECL_SECTION_NAME(NODE))
>
> Personally, I think it is clearer to simply write this as:
>
> #define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
> (DECL_SECTION_NAME(NODE) != NULL_TREE \
> && !DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE))
>
> Teresa
>
>> +
>> struct GTY(()) tree_decl_with_vis {
>> struct tree_decl_with_rtl common;
>> tree assembler_name;
>> --
>
>
>
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GOOGLE] Fix the bug where implicit section names prevents function splitting
2014-08-14 20:46 ` Yi Yang
@ 2014-08-14 20:49 ` Teresa Johnson
2014-08-14 20:53 ` Yi Yang
0 siblings, 1 reply; 5+ messages in thread
From: Teresa Johnson @ 2014-08-14 20:49 UTC (permalink / raw)
To: Yi Yang, David Li; +Cc: GCC Patches, Dehao Chen
On Thu, Aug 14, 2014 at 1:46 PM, Yi Yang <ahyangyi@google.com> wrote:
> Patch v2.
>
> Trunk no longer set SECTION_NAME for implicit section names, so this
> probably does not apply to trunk. It's probably not necessary for
> trunk either.
>
> Tested for Google 4.8(albeit unnecessary) and 4.9 branch.
>
> diff --git gcc/bb-reorder.c gcc/bb-reorder.c
> index a1b3e65..b9a829e 100644
> --- gcc/bb-reorder.c
> +++ gcc/bb-reorder.c
> @@ -2554,7 +2554,7 @@ gate_handle_partition_blocks (void)
> we are going to omit the reordering. */
> && optimize_function_for_speed_p (cfun)
> && !DECL_ONE_ONLY (current_function_decl)
> - && !DECL_SECTION_NAME (current_function_decl));
> + && !DECL_HAS_EXPLICIT_SECTION_NAME_P(current_function_decl));
> }
>
> /* This function is the main 'entrance' for the optimization that
> diff --git gcc/tree.h gcc/tree.h
> index b656b7b..308eef8 100644
> --- gcc/tree.h
> +++ gcc/tree.h
> @@ -2405,6 +2405,11 @@ extern void decl_value_expr_insert (tree, tree);
> #define DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE) \
> (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.implicit_section_name_p)
>
> +/* Speficy whether the section name was explicitly set with decl_attributes. */
Typo "Specify".
Otherwise looks ok to me.
Thanks,
Teresa
> +#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
> + (DECL_SECTION_NAME(NODE) != NULL_TREE \
> + && !DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE))
> +
> extern tree decl_debug_expr_lookup (tree);
> extern void decl_debug_expr_insert (tree, tree);
>
> --
>
> On Thu, Aug 14, 2014 at 11:25 AM, Teresa Johnson <tejohnson@google.com> wrote:
>> On Wed, Aug 13, 2014 at 9:03 PM, Yi Yang <ahyangyi@google.com> wrote:
>>> This bug is caused by my last patch, which did not differentiate
>>> between explicit section names (via attributes) and implicit section
>>> names (via -ffunction-section).
>>>
>>> This patch fixes that.
>>>
>>> --
>>>
>>> diff --git gcc/bb-reorder.c gcc/bb-reorder.c
>>> index 8f8c420..2115b01 100644
>>> --- gcc/bb-reorder.c
>>> +++ gcc/bb-reorder.c
>>> @@ -2505,7 +2505,7 @@ gate_handle_partition_blocks (void)
>>> we are going to omit the reordering. */
>>> && optimize_function_for_speed_p (cfun)
>>> && !DECL_ONE_ONLY (current_function_decl)
>>> - && !DECL_SECTION_NAME (current_function_decl));
>>> + && !DECL_HAS_EXPLICIT_SECTION_NAME_P(current_function_decl));
>>> }
>>>
>>> /* This function is the main 'entrance' for the optimization that
>>> diff --git gcc/tree.h gcc/tree.h
>>> index 817507f..738675a 100644
>>> --- gcc/tree.h
>>> +++ gcc/tree.h
>>> @@ -3201,6 +3201,11 @@ struct GTY(()) tree_parm_decl {
>>> #define DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE) \
>>> (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.implicit_section_name_p)
>>>
>>> +/* Speficy whether the section name was explicitly set with decl_attributes. */
>>> +#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
>>> + (DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE)? false: \
>>> + !!DECL_SECTION_NAME(NODE))
>>
>> Personally, I think it is clearer to simply write this as:
>>
>> #define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
>> (DECL_SECTION_NAME(NODE) != NULL_TREE \
>> && !DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE))
>>
>> Teresa
>>
>>> +
>>> struct GTY(()) tree_decl_with_vis {
>>> struct tree_decl_with_rtl common;
>>> tree assembler_name;
>>> --
>>
>>
>>
>> --
>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
--
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GOOGLE] Fix the bug where implicit section names prevents function splitting
2014-08-14 20:49 ` Teresa Johnson
@ 2014-08-14 20:53 ` Yi Yang
0 siblings, 0 replies; 5+ messages in thread
From: Yi Yang @ 2014-08-14 20:53 UTC (permalink / raw)
To: Teresa Johnson; +Cc: David Li, GCC Patches, Dehao Chen
Thank you. I fixed the typo and committed.
On Thu, Aug 14, 2014 at 1:49 PM, Teresa Johnson <tejohnson@google.com> wrote:
> On Thu, Aug 14, 2014 at 1:46 PM, Yi Yang <ahyangyi@google.com> wrote:
>> Patch v2.
>>
>> Trunk no longer set SECTION_NAME for implicit section names, so this
>> probably does not apply to trunk. It's probably not necessary for
>> trunk either.
>>
>> Tested for Google 4.8(albeit unnecessary) and 4.9 branch.
>>
>> diff --git gcc/bb-reorder.c gcc/bb-reorder.c
>> index a1b3e65..b9a829e 100644
>> --- gcc/bb-reorder.c
>> +++ gcc/bb-reorder.c
>> @@ -2554,7 +2554,7 @@ gate_handle_partition_blocks (void)
>> we are going to omit the reordering. */
>> && optimize_function_for_speed_p (cfun)
>> && !DECL_ONE_ONLY (current_function_decl)
>> - && !DECL_SECTION_NAME (current_function_decl));
>> + && !DECL_HAS_EXPLICIT_SECTION_NAME_P(current_function_decl));
>> }
>>
>> /* This function is the main 'entrance' for the optimization that
>> diff --git gcc/tree.h gcc/tree.h
>> index b656b7b..308eef8 100644
>> --- gcc/tree.h
>> +++ gcc/tree.h
>> @@ -2405,6 +2405,11 @@ extern void decl_value_expr_insert (tree, tree);
>> #define DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE) \
>> (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.implicit_section_name_p)
>>
>> +/* Speficy whether the section name was explicitly set with decl_attributes. */
>
> Typo "Specify".
>
> Otherwise looks ok to me.
>
> Thanks,
> Teresa
>
>> +#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
>> + (DECL_SECTION_NAME(NODE) != NULL_TREE \
>> + && !DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE))
>> +
>> extern tree decl_debug_expr_lookup (tree);
>> extern void decl_debug_expr_insert (tree, tree);
>>
>> --
>>
>> On Thu, Aug 14, 2014 at 11:25 AM, Teresa Johnson <tejohnson@google.com> wrote:
>>> On Wed, Aug 13, 2014 at 9:03 PM, Yi Yang <ahyangyi@google.com> wrote:
>>>> This bug is caused by my last patch, which did not differentiate
>>>> between explicit section names (via attributes) and implicit section
>>>> names (via -ffunction-section).
>>>>
>>>> This patch fixes that.
>>>>
>>>> --
>>>>
>>>> diff --git gcc/bb-reorder.c gcc/bb-reorder.c
>>>> index 8f8c420..2115b01 100644
>>>> --- gcc/bb-reorder.c
>>>> +++ gcc/bb-reorder.c
>>>> @@ -2505,7 +2505,7 @@ gate_handle_partition_blocks (void)
>>>> we are going to omit the reordering. */
>>>> && optimize_function_for_speed_p (cfun)
>>>> && !DECL_ONE_ONLY (current_function_decl)
>>>> - && !DECL_SECTION_NAME (current_function_decl));
>>>> + && !DECL_HAS_EXPLICIT_SECTION_NAME_P(current_function_decl));
>>>> }
>>>>
>>>> /* This function is the main 'entrance' for the optimization that
>>>> diff --git gcc/tree.h gcc/tree.h
>>>> index 817507f..738675a 100644
>>>> --- gcc/tree.h
>>>> +++ gcc/tree.h
>>>> @@ -3201,6 +3201,11 @@ struct GTY(()) tree_parm_decl {
>>>> #define DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE) \
>>>> (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.implicit_section_name_p)
>>>>
>>>> +/* Speficy whether the section name was explicitly set with decl_attributes. */
>>>> +#define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
>>>> + (DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE)? false: \
>>>> + !!DECL_SECTION_NAME(NODE))
>>>
>>> Personally, I think it is clearer to simply write this as:
>>>
>>> #define DECL_HAS_EXPLICIT_SECTION_NAME_P(NODE) \
>>> (DECL_SECTION_NAME(NODE) != NULL_TREE \
>>> && !DECL_HAS_IMPLICIT_SECTION_NAME_P(NODE))
>>>
>>> Teresa
>>>
>>>> +
>>>> struct GTY(()) tree_decl_with_vis {
>>>> struct tree_decl_with_rtl common;
>>>> tree assembler_name;
>>>> --
>>>
>>>
>>>
>>> --
>>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
>
>
>
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-08-14 20:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-14 4:03 [GOOGLE] Fix the bug where implicit section names prevents function splitting Yi Yang
2014-08-14 18:25 ` Teresa Johnson
2014-08-14 20:46 ` Yi Yang
2014-08-14 20:49 ` Teresa Johnson
2014-08-14 20:53 ` Yi Yang
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).