[flang-commits] [clang] [flang] [llvm] [openmp] [Clang][OpenMP] Add permutation clause (PR #92030)
Michael Kruse via flang-commits
flang-commits at lists.llvm.org
Tue Oct 8 08:53:52 PDT 2024
================
@@ -16029,6 +16074,44 @@ OMPClause *SemaOpenMP::ActOnOpenMPSizesClause(ArrayRef<Expr *> SizeExprs,
SanitizedSizeExprs);
}
+OMPClause *SemaOpenMP::ActOnOpenMPPermutationClause(ArrayRef<Expr *> PermExprs,
+ SourceLocation StartLoc,
+ SourceLocation LParenLoc,
+ SourceLocation EndLoc) {
+ size_t NumLoops = PermExprs.size();
+ SmallVector<Expr *> SanitizedPermExprs;
+ llvm::append_range(SanitizedPermExprs, PermExprs);
+
+ for (Expr *&PermExpr : SanitizedPermExprs) {
+ // Skip if template-dependent or already sanitized, e.g. during a partial
+ // template instantiation.
+ if (!PermExpr || PermExpr->isInstantiationDependent())
+ continue;
+
+ llvm::APSInt PermVal;
+ ExprResult PermEvalExpr = SemaRef.VerifyIntegerConstantExpression(
+ PermExpr, &PermVal, Sema::AllowFold);
+ bool IsValid = PermEvalExpr.isUsable();
+ if (IsValid)
----------------
Meinersbur wrote:
In partial template instantiations the expression may not evaluate to a constant yet because it depends on another template parameter. We cannot set `PermExpr` to nullptr because we need to preserve the expression to be evaluated at another call to `ActOnOpenMPPermutationClause` when the template is fully instantiated.
https://github.com/llvm/llvm-project/pull/92030
More information about the flang-commits
mailing list