Skip to content

Commit 0df5dee

Browse files
authored
[OpenMP] Apply COLLAPSE to innermost leaf that allows it (#167565)
As per the wording from 5.2, the COLLAPSE clause applies once to the entire construct. The 6.0 spec has a somewhat similar wording with the same intent. In practice, apply the clause to the innermost leaf constituent that allows it, without requiring it to be the exact innermost leaf.
1 parent d4b43f0 commit 0df5dee

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -501,18 +501,7 @@ template <typename C, typename H>
501501
bool ConstructDecompositionT<C, H>::applyClause(
502502
const tomp::clause::CollapseT<TypeTy, IdTy, ExprTy> &clause,
503503
const ClauseTy *node) {
504-
// Apply "collapse" to the innermost directive. If it's not one that
505-
// allows it flag an error.
506-
if (!leafs.empty()) {
507-
auto &last = leafs.back();
508-
509-
if (llvm::omp::isAllowedClauseForDirective(last.id, node->id, version)) {
510-
last.clauses.push_back(node);
511-
return true;
512-
}
513-
}
514-
515-
return false;
504+
return applyToInnermost(node);
516505
}
517506

518507
// DEFAULT

0 commit comments

Comments
 (0)