[OpenMP] Implement '#pragma omp unroll'.
authorMichael Kruse <llvm-project@meinersbur.de>
Thu, 10 Jun 2021 19:24:17 +0000 (14:24 -0500)
committerMichael Kruse <llvm-project@meinersbur.de>
Thu, 10 Jun 2021 19:30:17 +0000 (14:30 -0500)
commita22236120f17074532bec70f5916a235beddd475
treee35ff3802c63414060214adf61922971595a5beb
parente0c605f6383c5a3aa8f5fa34ed4be9dc51b4a2ae
[OpenMP] Implement '#pragma omp unroll'.

Implementation of the unroll directive introduced in OpenMP 5.1. Follows the approach from D76342 for the tile directive (i.e. AST-based, not using the OpenMPIRBuilder). Tries to use `llvm.loop.unroll.*` metadata where possible, but has to fall back to an AST representation of the outer loop if the partially unrolled generated loop is associated with another directive (because it needs to compute the number of iterations).

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D99459
40 files changed:
clang/include/clang-c/Index.h
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/AST/StmtOpenMP.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/StmtNodes.td
clang/include/clang/Sema/Sema.h
clang/include/clang/Serialization/ASTBitCodes.h
clang/lib/AST/OpenMPClause.cpp
clang/lib/AST/StmtOpenMP.cpp
clang/lib/AST/StmtPrinter.cpp
clang/lib/AST/StmtProfile.cpp
clang/lib/Basic/OpenMPKinds.cpp
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGStmt.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Parse/ParseOpenMP.cpp
clang/lib/Sema/SemaExceptionSpec.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
clang/test/OpenMP/unroll_ast_print.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_factor.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_for_collapse_outer.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_for_partial.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_full.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_heuristic.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_parallel_for_factor.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_partial.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_tile_for.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_codegen_unroll_for.cpp [new file with mode: 0644]
clang/test/OpenMP/unroll_messages.cpp [new file with mode: 0644]
clang/tools/libclang/CIndex.cpp
clang/tools/libclang/CXCursor.cpp
llvm/include/llvm/Frontend/OpenMP/OMP.td