This is an archive of the discontinued LLVM Phabricator instance.

[clang][OpenMP] Local variable alignment incorrect with align clause
ClosedPublic

Authored by ddpagan on Apr 29 2022, 8:23 AM.

Details

Summary

If alignment specified with align clause is less than natural alignment for list item type, the alignment should be set to the natural alignment.

See OMP5.1 specification, page 185, lines 7-10

Diff Detail

Event Timeline

ddpagan created this revision.Apr 29 2022, 8:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 29 2022, 8:23 AM
ddpagan requested review of this revision.Apr 29 2022, 8:23 AM
ABataev added inline comments.Apr 29 2022, 1:08 PM
clang/lib/CodeGen/CGOpenMPRuntime.cpp
12161
if (!Alignment)
  return nullptr;
12170–12176
return llvm::ConstantInt::get(CGF.CGM.SizeTy, std::max(UserAlign, NaturalAlign.getQuantity()));
12215–12216

What if the type is a reference?

ddpagan updated this revision to Diff 426453.EditedMay 2 2022, 10:44 AM

Thanks for the review, Alexey. Suggested changes have been made.

This revision is now accepted and ready to land.May 2 2022, 10:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 3 2022, 1:20 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript