================
@@ -508,6 +512,43 @@ OMPInterchangeDirective::CreateEmpty(const ASTContext &C,
unsigned NumClauses,
SourceLocation(), SourceLocation(), NumLoops);
}
+OMPFuseDirective *OMPFuseDirective::Create(
+ const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
+ ArrayRef<OMPClause *> Clauses, unsigned NumLoops, unsigned NumLoopNests,
+ Stmt *AssociatedStmt, Stmt *TransformedStmt, Stmt *PreInits) {
+
+ OMPFuseDirective *Dir = createDirective<OMPFuseDirective>(
+ C, Clauses, AssociatedStmt, TransformedStmtOffset + 1, StartLoc, EndLoc,
+ NumLoops);
+ Dir->setTransformedStmt(TransformedStmt);
+ Dir->setPreInits(PreInits);
+ // The number of top level canonical nests could
+ // not match the total number of generated loops
+ // Example:
+ // Before fusion:
+ // for (int i = 0; i < N; ++i)
+ // for (int j = 0; j < M; ++j)
+ // A[i][j] = i + j;
+ //
+ // for (int k = 0; k < P; ++k)
+ // B[k] = k * 2;
+ // Here, NumLoopNests = 2, but NumLoops = 3.
----------------
eZWALT wrote:
Yes I guessed that probably this information would not be used... However i
wanted to be consistent with other loop transformations and avoid changing the
structure for loop nest only related transformations, so I did the visitor just
for the sake of consistency. I know it might not be the best solution in terms
of redundancy and extra lines of code, but i believe its more consistent with
the rest of loop transformations. But again, you are 100% correct, the total
number of loops does not really mater without the loop nest structure.
https://github.com/llvm/llvm-project/pull/139293
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits