[PATCH] D94973: [clang][OpenMP] Use OpenMPIRBuilder for workshare loops.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 23:17:10 PST 2021


Meinersbur added inline comments.


================
Comment at: clang/include/clang/AST/StmtOpenMP.h:97
+/// `std::vector<std::string>::iterator::difference_type` aka `ptrdiff_t`).
+/// Therefore, the distance function will be <code>
+///   [&](size_t &Result) { Result = __end - __begin; }
----------------
jdenny wrote:
> 
Unfortunately, clang-format does this when it wants to word-wrap a paragraph.


================
Comment at: clang/include/clang/AST/StmtOpenMP.h:166
+    assert((isa<ForStmt>(S) || isa<CXXForRangeStmt>(S)) &&
+           "Canonical loop must be a for loop (range-based or otherwise)");
+    SubStmts[LOOPY_STMT] = S;
----------------
jdenny wrote:
> To convert run-time errors into compile-time errors, what if `setLoopStmt` is overloaded to take either a `ForStmt` or `CXXForRangeStmt` instead of any `Stmt`?
This would also require callers to call two different versions and just removes the problem up the call stack. For instance, StmtReader just receives a Stmt from ReadStmt. If we had setLoopStmt, we'd need a switch to call one of overloads.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94973/new/

https://reviews.llvm.org/D94973



More information about the llvm-commits mailing list