[all-commits] [llvm/llvm-project] 650bbc: [OpenMP][OpenMPIRBuilder] Implement loop unrolling.
Michael Kruse via All-commits
all-commits at lists.llvm.org
Sat Sep 4 17:24:13 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 650bbc56203c947bb85176c40ca9c7c7a91c3c57
https://github.com/llvm/llvm-project/commit/650bbc56203c947bb85176c40ca9c7c7a91c3c57
Author: Michael Kruse <llvm-project at meinersbur.de>
Date: 2021-09-04 (Sat, 04 Sep 2021)
Changed paths:
M clang/include/clang/Sema/Sema.h
M clang/lib/CodeGen/CGStmtOpenMP.cpp
M clang/lib/CodeGen/CodeGenFunction.h
M clang/lib/Parse/ParseOpenMP.cpp
M clang/lib/Sema/SemaOpenMP.cpp
A clang/test/OpenMP/irbuilder_unroll_full.c
A clang/test/OpenMP/irbuilder_unroll_heuristic.c
A clang/test/OpenMP/irbuilder_unroll_partial_factor.c
A clang/test/OpenMP/irbuilder_unroll_partial_factor_for.c
A clang/test/OpenMP/irbuilder_unroll_partial_factor_for_collapse.c
A clang/test/OpenMP/irbuilder_unroll_partial_heuristic.c
A clang/test/OpenMP/irbuilder_unroll_partial_heuristic_constant_for.c
A clang/test/OpenMP/irbuilder_unroll_partial_heuristic_for_collapse.c
A clang/test/OpenMP/irbuilder_unroll_partial_heuristic_runtime_for.c
A clang/test/OpenMP/irbuilder_unroll_unroll_partial_factor.c
A clang/test/OpenMP/irbuilder_unroll_unroll_partial_heuristic.c
M llvm/include/llvm/Analysis/LoopInfo.h
M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
M llvm/lib/Analysis/LoopInfo.cpp
M llvm/lib/Frontend/OpenMP/CMakeLists.txt
M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
M llvm/lib/Transforms/IPO/CMakeLists.txt
M llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
Log Message:
-----------
[OpenMP][OpenMPIRBuilder] Implement loop unrolling.
Recommit of 707ce34b06190e275572c3c46843036db1bab6d1. Don't introduce a
dependency to the LLVMPasses component, instead register the required
passes individually.
Add methods for loop unrolling to the OpenMPIRBuilder class and use them in Clang if `-fopenmp-enable-irbuilder` is enabled. The unrolling methods are:
* `unrollLoopFull`
* `unrollLoopPartial`
* `unrollLoopHeuristic`
`unrollLoopPartial` and `unrollLoopHeuristic` can use compiler heuristics to automatically determine the unroll factor. If possible, that is if no CanonicalLoopInfo is required to pass to another method, metadata for LLVM's LoopUnrollPass is added. Otherwise the unroll factor is determined using the same heurstics as user by LoopUnrollPass. Not requiring a CanonicalLoopInfo, especially with `unrollLoopHeuristic` allows greater flexibility.
With full unrolling and partial unrolling with known unroll factor, instead of duplicating instructions by the OpenMPIRBuilder, the full unroll is still delegated to the LoopUnrollPass. In case of partial unrolling the loop is first tiled using the existing `tileLoops` methods, then the inner loop fully unrolled using the same mechanism.
Reviewed By: jdoerfert, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D107764
More information about the All-commits
mailing list