From 5af4964443458dc46f6a8141fce29782dd880c46 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 6 Nov 2014 12:12:19 +0100 Subject: [PATCH] gpu_array_is_scalar: also consider a single struct as a scalar gpu_array_is_scalar is essentially used in two context, one is to determine whether an "&" should be printed and the other is to determine whether we are capable of mapping the array to registers. It is only in the second case that we need to exclude structs since we currently do not map any (arrays of) structs to shared or private memory. Move the test for compound elements out of gpu_array_is_scalar to the instance where we actually need to test for it. Signed-off-by: Sven Verdoolaege --- gpu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gpu.c b/gpu.c index 5e369a4..1f605bd 100644 --- a/gpu.c +++ b/gpu.c @@ -562,7 +562,7 @@ void collect_order_dependences(struct gpu_prog *prog) order = remove_independences(prog, array, order); array->dep_order = order; - if (gpu_array_is_scalar(array)) + if (gpu_array_is_scalar(array) && !array->has_compound_element) continue; prog->array_order = isl_union_map_union(prog->array_order, @@ -631,12 +631,11 @@ static void free_array_info(struct gpu_prog *prog) /* Check if a gpu array is a scalar. A scalar is a value that is not stored * as an array or through a pointer reference, but as a single data element. * At the moment, scalars are represented as zero-dimensional arrays. - * A zero-dimensional array containing structures is not considered - * to be a scalar. + * Note that the single data element may be an entire structure. */ int gpu_array_is_scalar(struct gpu_array_info *array) { - return !array->has_compound_element && array->n_index == 0; + return array->n_index == 0; } /* Is "array" a read-only scalar? -- 2.11.4.GIT