[openacc] use existing local variable in cp_parser_oacc_enter_exit_data

Message ID fd051cc7-d4ce-6728-4995-3d1be3796570@codesourcery.com
State New
Headers show
Series
  • [openacc] use existing local variable in cp_parser_oacc_enter_exit_data
Related show

Commit Message

Cesar Philippidis Sept. 26, 2018, 6:21 p.m.
This is an old gomp4 patch that updates the location of the clause for
acc enter/exit data. Apparently, it didn't impact any test cases. Is
this OK for trunk or should we drop it from OG8?

I bootstrapped and regtested it for x86_64 Linux with nvptx offloading.

Thanks,
Cesar

Comments

Julian Brown Nov. 29, 2018, 9:33 p.m. | #1
On Wed, 26 Sep 2018 11:21:33 -0700
Cesar Philippidis <cesar@codesourcery.com> wrote:

> This is an old gomp4 patch that updates the location of the clause for

> acc enter/exit data. Apparently, it didn't impact any test cases. Is

> this OK for trunk or should we drop it from OG8?

> 

> I bootstrapped and regtested it for x86_64 Linux with nvptx

> offloading.


At least at a glance, there is no actual change to behaviour given in
this patch, it is just an extremely minor cleanup. I.e. in:

  location_t loc = pragma_tok->location;
  [...]
  SET_EXPR_LOCATION (stmt, pragma_tok->location);

the variable "loc" is used in the SET_EXPR_LOCATION instead. It doesn't
look like anything could mutate either variable in the interim.

So, OK, or shall we just drop this? (Joseph?)

Thanks,

Julian
Joseph Myers Nov. 29, 2018, 9:43 p.m. | #2
On Thu, 29 Nov 2018, Julian Brown wrote:

> So, OK, or shall we just drop this? (Joseph?)


I've no comment on this patch; it seems to be in Thomas's area.

-- 
Joseph S. Myers
joseph@codesourcery.com
Thomas Schwinge Nov. 30, 2018, 9:05 p.m. | #3
Hi!

On Thu, 29 Nov 2018 21:33:37 +0000, Julian Brown <julian@codesourcery.com> wrote:
> On Wed, 26 Sep 2018 11:21:33 -0700

> Cesar Philippidis <cesar@codesourcery.com> wrote:

> 

> > This is an old gomp4 patch that updates the location of the clause for

> > acc enter/exit data. Apparently, it didn't impact any test cases. Is

> > this OK for trunk or should we drop it from OG8?

> > 

> > I bootstrapped and regtested it for x86_64 Linux with nvptx

> > offloading.

> 

> At least at a glance, there is no actual change to behaviour given in

> this patch, it is just an extremely minor cleanup. I.e. in:

> 

>   location_t loc = pragma_tok->location;

>   [...]

>   SET_EXPR_LOCATION (stmt, pragma_tok->location);

> 

> the variable "loc" is used in the SET_EXPR_LOCATION instead. It doesn't

> look like anything could mutate either variable in the interim.


Thanks, agreed.

> So, OK, or shall we just drop this?


This tiny change obviously should've been part of (much) earlier changes
(when that code was reworked, "loc" added), and has now gotten much too
much attention already; committed to trunk in r266687:

commit 52b928e7cd1b7dee36c4ea14b5ac9df3f022efd5
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Nov 30 20:39:40 2018 +0000

    [C++] Use existing local variable in cp_parser_oacc_enter_exit_data
    
            gcc/cp/
            * parser.c (cp_parser_oacc_enter_exit_data): Use existing local
            variable.
    
    Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>

    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266687 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/cp/ChangeLog | 5 +++++
 gcc/cp/parser.c  | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git gcc/cp/ChangeLog gcc/cp/ChangeLog
index 98a2528783a9..2c8b7d10ae4e 100644
--- gcc/cp/ChangeLog
+++ gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-30  James Norris  <jnorris@codesourcery.com>
+
+	* parser.c (cp_parser_oacc_enter_exit_data): Use existing local
+	variable.
+
 2018-11-29  Paolo Carlini  <paolo.carlini@oracle.com>
 
 	* decl.c (compute_array_index_type_loc): New, like the current
diff --git gcc/cp/parser.c gcc/cp/parser.c
index 3ef1eda45188..634485b5a8c7 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -38472,7 +38472,7 @@ cp_parser_oacc_enter_exit_data (cp_parser *parser, cp_token *pragma_tok,
   stmt = enter ? make_node (OACC_ENTER_DATA) : make_node (OACC_EXIT_DATA);
   TREE_TYPE (stmt) = void_type_node;
   OMP_STANDALONE_CLAUSES (stmt) = clauses;
-  SET_EXPR_LOCATION (stmt, pragma_tok->location);
+  SET_EXPR_LOCATION (stmt, loc);
   add_stmt (stmt);
   return stmt;
 }


Grüße
 Thomas

Patch

[OpenACC] Use existing local variable in cp_parser_oacc_enter_exit_data

2018-XX-YY  James Norris <jnorris@codesourcery.com>
	    Cesar Philippidis  <cesar@codesourcery.com>

	gcc/cp/
	* parser.c (cp_parser_oacc_enter_exit_data): Use existing local
	variable.

(cherry picked from gomp-4_0-branch r223007)
---

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 89f239e0f20..c6ebc494e59 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -37064,7 +37064,7 @@  cp_parser_oacc_enter_exit_data (cp_parser *parser, cp_token *pragma_tok,
   stmt = enter ? make_node (OACC_ENTER_DATA) : make_node (OACC_EXIT_DATA);
   TREE_TYPE (stmt) = void_type_node;
   OMP_STANDALONE_CLAUSES (stmt) = clauses;
-  SET_EXPR_LOCATION (stmt, pragma_tok->location);
+  SET_EXPR_LOCATION (stmt, loc);
   add_stmt (stmt);
   return stmt;
 }
-- 
2.17.1