public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix BLOCK_SUPERCONTEXT for cilk produced functions
@ 2014-07-04  9:05 Jan Hubicka
  2014-07-07 17:47 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Hubicka @ 2014-07-04  9:05 UTC (permalink / raw)
  To: gcc-patches, law

Hi,
BLOCK_SUPERCONTEXT for normal blocks leads all the way to FUNCTOIN_DECL.  This is not the case of some
automatically generated functions, like one for cilk.  I think it is bug. This patch fixes cilk, I will
look for other cases if that looks OK.

Bootstrapped/regtested x86_64-linux

Honza

	* cilk.c (create_cilk_helper_decl): Create toplevel block correctly.
Index: cilk.c
===================================================================
--- cilk.c	(revision 212278)
+++ cilk.c	(working copy)
@@ -314,6 +314,7 @@ create_cilk_helper_decl (struct wrapper_
   tree block = make_node (BLOCK);
   DECL_INITIAL (fndecl) = block;
   TREE_USED (block) = 1;
+  BLOCK_SUPERCONTEXT (block) = fndecl;
   gcc_assert (!DECL_SAVED_TREE (fndecl));
 
   /* Inlining would defeat the purpose of this wrapper.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix BLOCK_SUPERCONTEXT for cilk produced functions
  2014-07-04  9:05 Fix BLOCK_SUPERCONTEXT for cilk produced functions Jan Hubicka
@ 2014-07-07 17:47 ` Jeff Law
  2014-07-07 20:14   ` Jan Hubicka
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2014-07-07 17:47 UTC (permalink / raw)
  To: Jan Hubicka, gcc-patches

On 07/04/14 03:05, Jan Hubicka wrote:
> Hi,
> BLOCK_SUPERCONTEXT for normal blocks leads all the way to FUNCTOIN_DECL.  This is not the case of some
> automatically generated functions, like one for cilk.  I think it is bug. This patch fixes cilk, I will
> look for other cases if that looks OK.
>
> Bootstrapped/regtested x86_64-linux
>
> Honza
>
> 	* cilk.c (create_cilk_helper_decl): Create toplevel block correctly.
But doesn't this put the CILK created FUNCTION_DECL within the scope FNDECL?

Though I guess that may be reasonable since these decls are created in 
response to the spawn keyword.  To some degree they are nested within 
the scope of the current function.

OK.

jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix BLOCK_SUPERCONTEXT for cilk produced functions
  2014-07-07 17:47 ` Jeff Law
@ 2014-07-07 20:14   ` Jan Hubicka
  2014-07-18  5:06     ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Hubicka @ 2014-07-07 20:14 UTC (permalink / raw)
  To: Jeff Law; +Cc: Jan Hubicka, gcc-patches

> On 07/04/14 03:05, Jan Hubicka wrote:
> >Hi,
> >BLOCK_SUPERCONTEXT for normal blocks leads all the way to FUNCTOIN_DECL.  This is not the case of some
> >automatically generated functions, like one for cilk.  I think it is bug. This patch fixes cilk, I will
> >look for other cases if that looks OK.
> >
> >Bootstrapped/regtested x86_64-linux
> >
> >Honza
> >
> >	* cilk.c (create_cilk_helper_decl): Create toplevel block correctly.
> But doesn't this put the CILK created FUNCTION_DECL within the scope FNDECL?

I am not sure I understand your question...
FNDECL is a newly created decl that will get its body filled in later. I
believe the BLOCK_SUPERCONTEXT of its main block should be always FNDECL
instead of NULL as for was majority of functions we produce...
if that function contains code outlined from the main function, I think
these are linked by ABSTRACT_ORIGIN.

Honza
> 
> Though I guess that may be reasonable since these decls are created
> in response to the spawn keyword.  To some degree they are nested
> within the scope of the current function.
> 
> OK.
> 
> jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fix BLOCK_SUPERCONTEXT for cilk produced functions
  2014-07-07 20:14   ` Jan Hubicka
@ 2014-07-18  5:06     ` Jeff Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2014-07-18  5:06 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

On 07/07/14 14:14, Jan Hubicka wrote:
>> On 07/04/14 03:05, Jan Hubicka wrote:
>>> Hi,
>>> BLOCK_SUPERCONTEXT for normal blocks leads all the way to FUNCTOIN_DECL.  This is not the case of some
>>> automatically generated functions, like one for cilk.  I think it is bug. This patch fixes cilk, I will
>>> look for other cases if that looks OK.
>>>
>>> Bootstrapped/regtested x86_64-linux
>>>
>>> Honza
>>>
>>> 	* cilk.c (create_cilk_helper_decl): Create toplevel block correctly.
>> But doesn't this put the CILK created FUNCTION_DECL within the scope FNDECL?
>
> I am not sure I understand your question...
> FNDECL is a newly created decl that will get its body filled in later. I
> believe the BLOCK_SUPERCONTEXT of its main block should be always FNDECL
> instead of NULL as for was majority of functions we produce...
> if that function contains code outlined from the main function, I think
> these are linked by ABSTRACT_ORIGIN.
Nevermind.  I was confused about the state fndecl & the context chains.

OK for the trunk and 4.9 if you think it's important to address there as 
well

jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-18  5:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-04  9:05 Fix BLOCK_SUPERCONTEXT for cilk produced functions Jan Hubicka
2014-07-07 17:47 ` Jeff Law
2014-07-07 20:14   ` Jan Hubicka
2014-07-18  5:06     ` Jeff Law

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).