Message ID | BF230D13CA30DD48930C31D40993300016C4E996@FMSMSX102.amr.corp.intel.com |
---|---|
State | New |
Headers | show |
> Index: gcc/cp/parser.c > =================================================================== > --- gcc/cp/parser.c (revision 190195) > +++ gcc/cp/parser.c (working copy) > @@ -28351,6 +28351,13 @@ > FOR_EXPR (statement) = decl; > CILK_FOR_GRAIN (statement) = grain; > > + /* If an initial value is available, and it is of type integer, then we > + save it in CILK_FOR_INIT. */ > + if (init && TREE_TYPE (init) && INTEGRAL_TYPE_P (TREE_TYPE (init))) > + CILK_FOR_INIT (statement) = init; > + else > + CILK_FOR_INIT (statement) = NULL_TREE; > + Shouldn't you only set this for flag_cilkplus (?), or does it need to be set for non Cilk instances of the compiler?
Hello Aldy, The only time we will get into this function (cp_parser_cilk_for) is when the fcilkplus is turned on. Here is the original call for this function (line #9983) : if (!flag_enable_cilk) fatal_error ("-fcilkplus must be enabled to use %<cilk_for%>"); else statement = cp_parser_cilk_for (parser, (tree) NULL_TREE, parser->in_statement); Thanks, Balaji V. Iyer. -----Original Message----- From: Aldy Hernandez [mailto:aldyh@redhat.com] Sent: Wednesday, August 08, 2012 2:23 PM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][Cilkplus] Remove unwanted static chain. > Index: gcc/cp/parser.c > =================================================================== > --- gcc/cp/parser.c (revision 190195) > +++ gcc/cp/parser.c (working copy) > @@ -28351,6 +28351,13 @@ > FOR_EXPR (statement) = decl; > CILK_FOR_GRAIN (statement) = grain; > > + /* If an initial value is available, and it is of type integer, then we > + save it in CILK_FOR_INIT. */ > + if (init && TREE_TYPE (init) && INTEGRAL_TYPE_P (TREE_TYPE (init))) > + CILK_FOR_INIT (statement) = init; else > + CILK_FOR_INIT (statement) = NULL_TREE; > + Shouldn't you only set this for flag_cilkplus (?), or does it need to be set for non Cilk instances of the compiler?
On 08/08/12 13:27, Iyer, Balaji V wrote: > Hello Aldy, > The only time we will get into this function (cp_parser_cilk_for) is when the fcilkplus is turned on. > > Here is the original call for this function (line #9983) : > > if (!flag_enable_cilk) > fatal_error ("-fcilkplus must be enabled to use %<cilk_for%>"); > else > statement = cp_parser_cilk_for (parser, (tree) NULL_TREE, parser->in_statement); > Whoops, my bad. I should catch up on the rest of your changes before commenting :). Carry on...
Its ok. I am glad you are catching all these, it makes me rethink and recheck. Thanks, Balaji V. Iyer. -----Original Message----- From: Aldy Hernandez [mailto:aldyh@redhat.com] Sent: Wednesday, August 08, 2012 2:29 PM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][Cilkplus] Remove unwanted static chain. On 08/08/12 13:27, Iyer, Balaji V wrote: > Hello Aldy, > The only time we will get into this function (cp_parser_cilk_for) is when the fcilkplus is turned on. > > Here is the original call for this function (line #9983) : > > if (!flag_enable_cilk) > fatal_error ("-fcilkplus must be enabled to use %<cilk_for%>"); > else > statement = cp_parser_cilk_for (parser, (tree) NULL_TREE, > parser->in_statement); > Whoops, my bad. I should catch up on the rest of your changes before commenting :). Carry on...
Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 190195) +++ gcc/cp/parser.c (working copy) @@ -28351,6 +28351,13 @@ FOR_EXPR (statement) = decl; CILK_FOR_GRAIN (statement) = grain; + /* If an initial value is available, and it is of type integer, then we + save it in CILK_FOR_INIT. */ + if (init && TREE_TYPE (init) && INTEGRAL_TYPE_P (TREE_TYPE (init))) + CILK_FOR_INIT (statement) = init; + else + CILK_FOR_INIT (statement) = NULL_TREE; + finish_cilk_for_init_stmt (statement); if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)) Index: gcc/cp/ChangeLog.cilk =================================================================== --- gcc/cp/ChangeLog.cilk (revision 190195) +++ gcc/cp/ChangeLog.cilk (working copy) @@ -1,3 +1,7 @@ +2012-08-07 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * parser.c (cp_parser_cilk_for): Stored the initial value in cilk_for tree. + 2012-08-01 Balaji V. Iyer <balaji.v.iyer@intel.com> * parser.c (cp_parser_userdef_char_literal): Replaced CALL_SPAWN and
Sorry, I was in the wrong directory when I was creating the patch. Here is the fixed patch. Thanks, Balaji V. Iyer. -----Original Message----- From: Iyer, Balaji V Sent: Tuesday, August 07, 2012 4:18 PM To: 'gcc-patches@gcc.gnu.org' Subject: [PATCH][Cilkplus] Remove unwanted static chain. Hello Everyone, This patch is for the Cilk Plus branch affecting mainly the C++ compiler. This patch will store the initial value of a loop correctly and remove the unnecessary static chain usage for some cases of Cilk_for. Thanks, Balaji V. Iyer.