[OpenMP][FIX] Properly align firstprivate variables
authorJohannes Doerfert <johannes@jdoerfert.de>
Mon, 27 Feb 2023 21:31:05 +0000 (13:31 -0800)
committerJohannes Doerfert <johannes@jdoerfert.de>
Tue, 28 Feb 2023 01:34:46 +0000 (17:34 -0800)
commit89a8077f3d68f0f431f3657a8805f7751f5eac69
treeee9067049f0a06a62f47293ea942522e70cb2b39
parentda0d816567e229da01b5663e8587114d469e2b0b
[OpenMP][FIX] Properly align firstprivate variables

The old code didn't actually align the values, and it added padding even
when none was necessary. This approach will pad entries if necessary
and, similar to the struct case, use the host pointer as guidance.

NOTE: This does still not align them as the host has, but it's unclear
      if the user really should use the alignment bits anyway. For now
      this is a reasonable compromise, only if we have host alignment
      information (explicitly not implicitly via the host pointer), we
      could do it completely right without wasting lots of resources for
      >99% of the cases.

Fixes: https://github.com/llvm/llvm-project/issues/61034
openmp/libomptarget/src/omptarget.cpp
openmp/libomptarget/test/mapping/firstprivate_aligned.cpp [new file with mode: 0644]