[flang-commits] [flang] [flang][OpenMP] Move check of ALIGN clause to visitor function (PR #164261)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Tue Oct 21 04:17:16 PDT 2025
================
@@ -3898,6 +3882,19 @@ void OmpStructureChecker::CheckIsLoopIvPartOfClause(
}
}
+void OmpStructureChecker::Enter(const parser::OmpClause::Align &x) {
+ CheckAllowedClause(llvm::omp::Clause::OMPC_align);
+ if (const auto &v{GetIntValue(x.v.v)}) {
+ if (*v <= 0) {
+ context_.Say(GetContext().clauseSource,
+ "The alignment should be positive"_err_en_US);
+ } else if (!llvm::isPowerOf2_64(*v)) {
+ context_.Say(GetContext().clauseSource,
+ "The alignment should be a power of 2"_err_en_US);
----------------
kparzysz wrote:
For the ALIGN clause it actually does: [6.0:309:20-21]. I was a bit surprised about the discrepancy too.
> Restrictions to the align clause are as follows:
> • alignment must evaluate to a power of two.
I suppose the difference is that ALIGN requests an alignment from the allocator, while ALIGNED informs the compiler about existing alignment.
I can remove this check, let me know what you think.
https://github.com/llvm/llvm-project/pull/164261
More information about the flang-commits
mailing list