Skip to content

Commit 27d68a8

Browse files
committed
[MLIR][OpenMP] Independent omp.loop_nest translation
This patch refactors the process of translating loop wrappers and `omp.loop_nest` operations so that both are independent. This makes all these loop-related operations be handled using the same process, instead of the previous approach where `omp.loop_nest`s were handled directly as part of their associated loop wrappers. In order to still have access to the collapsed loop CanonicalLoopInfo information while translating loop wrappers, this is stored as stack frames in the `ModuleTranslation` object initialized when translating the loop itself and available to parent loop wrappers afterwards.
1 parent 4211b4d commit 27d68a8

File tree

3 files changed

+252
-227
lines changed

3 files changed

+252
-227
lines changed

mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,12 @@ class ModuleTranslation {
290290
/// Calls `callback` for every ModuleTranslation stack frame of type `T`
291291
/// starting from the top of the stack.
292292
template <typename T>
293-
WalkResult
294-
stackWalk(llvm::function_ref<WalkResult(const T &)> callback) const {
293+
WalkResult stackWalk(llvm::function_ref<WalkResult(T &)> callback) {
295294
static_assert(std::is_base_of<StackFrame, T>::value,
296295
"expected T derived from StackFrame");
297296
if (!callback)
298297
return WalkResult::skip();
299-
for (const std::unique_ptr<StackFrame> &frame : llvm::reverse(stack)) {
298+
for (std::unique_ptr<StackFrame> &frame : llvm::reverse(stack)) {
300299
if (T *ptr = dyn_cast_or_null<T>(frame.get())) {
301300
WalkResult result = callback(*ptr);
302301
if (result.wasInterrupted())

0 commit comments

Comments
 (0)