[OpenMP] Add more comments to ConstructDecompositionT.h, NFC#167564
Merged
[OpenMP] Add more comments to ConstructDecompositionT.h, NFC#167564
ConstructDecompositionT.h, NFC#167564Conversation
Member
|
@llvm/pr-subscribers-flang-openmp Author: Krzysztof Parzyszek (kparzysz) ChangesFull diff: https://github.com/llvm/llvm-project/pull/167564.diff 1 Files Affected:
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index d702273cec9ec..3918cecfc1e65 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -68,17 +68,16 @@ find_unique(Container &&container, Predicate &&pred) {
namespace tomp {
-// ClauseType - Either instance of ClauseT, or a type derived from ClauseT.
-//
-// This is the clause representation in the code using this infrastructure.
-//
-// HelperType - A class that implements two member functions:
+// ClauseType: Either an instance of ClauseT, or a type derived from ClauseT.
+// This is the clause representation in the code using this infrastructure.
//
+// HelperType: A class that implements two member functions:
// // Return the base object of the given object, if any.
// std::optional<Object> getBaseObject(const Object &object) const
// // Return the iteration variable of the outermost loop associated
// // with the construct being worked on, if any.
// std::optional<Object> getLoopIterVar() const
+
template <typename ClauseType, typename HelperType>
struct ConstructDecompositionT {
using ClauseTy = ClauseType;
@@ -181,27 +180,32 @@ struct ConstructDecompositionT {
std::enable_if_t<llvm::remove_cvref_t<U>::UnionTrait::value, void>
addClauseSymsToMap(U &&item, const ClauseTy *);
- // Apply a clause to the only directive that allows it. If there are no
+ // Apply the clause to the only directive that allows it. If there are no
// directives that allow it, or if there is more that one, do not apply
// anything and return false, otherwise return true.
bool applyToUnique(const ClauseTy *node);
- // Apply a clause to the first directive in given range that allows it.
+ // Apply the clause to the first directive in given range that allows it.
// If such a directive does not exist, return false, otherwise return true.
template <typename Iterator>
bool applyToFirst(const ClauseTy *node, llvm::iterator_range<Iterator> range);
- // Apply a clause to the innermost directive that allows it. If such a
+ // Apply the clause to the innermost directive that allows it. If such a
// directive does not exist, return false, otherwise return true.
bool applyToInnermost(const ClauseTy *node);
- // Apply a clause to the outermost directive that allows it. If such a
+ // Apply the clause to the outermost directive that allows it. If such a
// directive does not exist, return false, otherwise return true.
bool applyToOutermost(const ClauseTy *node);
+ // Apply the clause to all directives that allow it, and which satisfy
+ // the predicate: bool shouldApply(LeafReprInternal). If no such
+ // directives exist, return false, otherwise return true.
template <typename Predicate>
bool applyIf(const ClauseTy *node, Predicate shouldApply);
+ // Apply the clause to all directives that allow it. If no such directives
+ // exist, return false, otherwise return true.
bool applyToAll(const ClauseTy *node);
template <typename Clause>
@@ -983,7 +987,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
return dir == llvm::omp::Directive::OMPD_simd ||
llvm::is_contained(getWorksharingLoop(), dir);
case ReductionModifier::Task:
- if (alreadyApplied)
+ if (alreadyApplied) // Not an error
return false;
// According to [5.2:135:16-18], "task" only applies to "parallel" and
// worksharing constructs.
|
tblah
approved these changes
Nov 12, 2025
Stylie777
approved these changes
Nov 12, 2025
git-crd
pushed a commit
to git-crd/crd-llvm-project
that referenced
this pull request
Nov 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.