[PATCH] D74658: [mlir][NFC] Fix 'gatherLoops' utility
Diego Caballero via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 08:53:36 PST 2020
dcaballe marked an inline comment as done.
dcaballe added a comment.
Thanks!
================
Comment at: mlir/lib/Transforms/Utils/LoopUtils.cpp:1809
+ depthToLoops.pop_back();
+ }
}
----------------
mehdi_amini wrote:
> Why is this pop_back() needed now? Or do you just view this as an "optimization"?
This is not to keep an empty level around in the output. For example, let's say we have two nested loops in a function. The algorithm would proceed as follows:
- Visit function body, add level 0 to output, add the outer loop to level 0.
- Visit the outer loop body, add level 1 to output, add the inner loop to level 1.
- Visit inner loop body, add level 2 to output, no loops are added to level 2.
- Remove level 2 since it's empty.
I'm now thinking that I could move this removal to the public 'gatherLoops' function so that it's only executed once since the empty level will always be one and the last one in the output vector, no matter how many or the structure of the loop nests visited.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74658/new/
https://reviews.llvm.org/D74658
More information about the llvm-commits
mailing list