[Mlir-commits] [mlir] [mlir][spirv] Allow yielding values from loop regions (PR #135344)
Igor Wodiany
llvmlistbot at llvm.org
Tue Apr 29 10:13:32 PDT 2025
================
@@ -2003,7 +2003,8 @@ LogicalResult ControlFlowStructurizer::structurize() {
// block inside the selection (`body.back()`). Values produced by block
// arguments will be yielded by the selection region. We do not update uses or
// erase original block arguments yet. It will be done later in the code.
- if (!isLoop) {
+ // We do not currently support block arguments in loop merge blocks.
----------------
IgWod-IMG wrote:
If you look above (lines 1971-1974) there is a piece of code specific to loops that fails if there are block arguments in the merge block, then the next statements (lines 1979-1980) copy arguments from the header block to the merge block. So, running this code for loops would yield arguments that were copied from the header block into the merge block. I'm not sure it's a desired behaviour or at least I don't have / can't think of an example where this is a desired behaviour. So, I don't run this code for loops. Worst case scenario, there will be some uses that escape the loop but that should be caught later. Maybe the comment in the code should make it clearer.
Hope that explains the rational and somehow answers the question.
https://github.com/llvm/llvm-project/pull/135344
More information about the Mlir-commits
mailing list