* [committed] Fix alignment for OpenMP mapped array sections with non-zero bias (PR middle-end/63247)
@ 2014-09-29 5:27 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2014-09-29 5:27 UTC (permalink / raw)
To: gcc-patches
Hi!
For OMP_CLAUSE_MAP_POINTER on arrays (rather than pointers), when the
bias is non-zero, we pass map those as a pointer mapping, so need
to request alignment of the pointer variable rather than the array
itself.
Fixed thusly, bootstrapped/tested on x86_64-linux and i686-linux,
committed to trunk/4.9.
2014-09-29 Jakub Jelinek <jakub@redhat.com>
PR middle-end/63247
* omp-low.c (lower_omp_target): For OMP_CLAUSE_MAP_POINTER
of ARRAY_TYPE, if not OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION
use the alignment of avar rather than ovar.
--- gcc/omp-low.c.jj 2014-09-22 12:13:21.000000000 +0200
+++ gcc/omp-low.c 2014-09-26 11:40:20.185658337 +0200
@@ -10117,6 +10117,9 @@ lower_omp_target (gimple_stmt_iterator *
continue;
}
+ unsigned int talign = TYPE_ALIGN_UNIT (TREE_TYPE (ovar));
+ if (DECL_P (ovar) && DECL_ALIGN_UNIT (ovar) > talign)
+ talign = DECL_ALIGN_UNIT (ovar);
if (nc)
{
tree var = lookup_decl_in_outer_ctx (ovar, ctx);
@@ -10131,6 +10134,7 @@ lower_omp_target (gimple_stmt_iterator *
= create_tmp_var (TREE_TYPE (TREE_TYPE (x)), NULL);
mark_addressable (avar);
gimplify_assign (avar, build_fold_addr_expr (var), &ilist);
+ talign = DECL_ALIGN_UNIT (avar);
avar = build_fold_addr_expr (avar);
gimplify_assign (x, avar, &ilist);
}
@@ -10183,9 +10187,6 @@ lower_omp_target (gimple_stmt_iterator *
default:
gcc_unreachable ();
}
- unsigned int talign = TYPE_ALIGN_UNIT (TREE_TYPE (ovar));
- if (DECL_P (ovar) && DECL_ALIGN_UNIT (ovar) > talign)
- talign = DECL_ALIGN_UNIT (ovar);
talign = ceil_log2 (talign);
tkind |= talign << 3;
CONSTRUCTOR_APPEND_ELT (vkind, purpose,
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-29 5:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29 5:27 [committed] Fix alignment for OpenMP mapped array sections with non-zero bias (PR middle-end/63247) Jakub Jelinek
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).