This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Allow const parameters in declare simd linear clause
ClosedPublic

Authored by huntergr on Feb 28 2020, 6:16 AM.

Details

Summary

Section 2.19.3 (List Item Privatization) of the OpenMP 5.0 standard does not apply to declarative directives, only to constructs. As such it's legal for a const-qualified function parameter to be marked as linear in a declare simd directive. I have confirmed this with the language committee.

Suggestions on a better approach are welcome -- I tried using DSAStack, but it didn't have a valid current directive when the restriction was checked.

Diff Detail

Event Timeline

huntergr created this revision.Feb 28 2020, 6:16 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: guansong. · View Herald Transcript
This revision is now accepted and ready to land.Feb 28 2020, 6:45 AM
fpetrogalli added inline comments.
clang/test/OpenMP/declare_simd_codegen.cpp
118

Shouldn't you check that the _ZGV * name is generated?

huntergr added inline comments.Feb 28 2020, 7:11 AM
clang/test/OpenMP/declare_simd_codegen.cpp
118

Ok, and I can take care of the formatting issue as well.

huntergr updated this revision to Diff 247294.Feb 28 2020, 9:37 AM
  • Added a function body to the test so that it would generate symbols
  • Added check lines to ensure the mangled name is present
  • Reformatted the params of Sema::CheckOpenMPLinearDecl to comply with coding style.
huntergr marked an inline comment as done.Feb 28 2020, 9:38 AM
fpetrogalli added inline comments.Feb 28 2020, 9:47 AM
clang/test/OpenMP/declare_simd_codegen.cpp
327

I think we should add the same checks in the AArch64 test: OpenMP/declare_simd_aarch64.c, so that we won't forget about it when we switch to the vector-function-abi-variant attribute.

huntergr updated this revision to Diff 247614.Mar 2 2020, 5:59 AM
  • Removed the ) my editor helpfully added to the CHECK line
  • Added a test to declare_simd_aarch64.c
fpetrogalli accepted this revision.Mar 2 2020, 6:35 AM

LGTM, thank you @huntergr !

This revision was automatically updated to reflect the committed changes.