On 04/03/2018 05:00 PM, Tom de Vries wrote:
On 03/02/2018 05:55 PM, Cesar Philippidis wrote:
    * config/nvptx/nvptx.c (oacc_bcast_partition): Declare.

One last thing: this variable needs to be reset to zero for every function.

Without this reset, we can generated different code for a function depending on whether there's another function in front or not.

In the previous commit, I set that variable in nvptx_option_override, but as I've found out that's not enough.

This patch does the init in nvptx_set_current_function.

Build x86_64 with nvptx accelerator and reg-tested libgomp.

Committed.

Thanks,
- Tom
[nvptx] Add per-function initialization of oacc_broadcast_partition

2018-04-05  Tom de Vries  <t...@codesourcery.com>

	* config/nvptx/nvptx.c (nvptx_set_current_function): Initialize
	oacc_broadcast_partition.

---
 gcc/config/nvptx/nvptx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 0b46e13..009ca59 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -5962,6 +5962,7 @@ nvptx_set_current_function (tree fndecl)
 
   gangprivate_shared_hmap.empty ();
   nvptx_previous_fndecl = fndecl;
+  oacc_bcast_partition = 0;
 }
 
 #undef TARGET_OPTION_OVERRIDE

Reply via email to