[PATCH] D77543: [mlir][spirv] Fix wrong Phi parent block for back-to-back loops
Lei Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 09:45:19 PDT 2020
antiagainst marked 2 inline comments as done.
antiagainst added inline comments.
================
Comment at: mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp:99
+ Operation *op = loopOp.getOperation();
+ while ((op = op->getPrevNode()) != nullptr)
+ if (Block *incomingBlock = getStructuredControlFlowOpMergeBlock(op))
----------------
mravishankar wrote:
> Just to clarify, this loop executes at most 1 iteration? If so can we avoid having a while loop? That makes it more confusing IMO
Not necessary. This actually scans all previous ops before this loop op. For example, you can have the following:
```
spv.loop { ... } // loop1
spv.Load
spv.Bla
spv.Store
spv.loop { ... } // loop2
```
Here if loop2 has some block arguments that require phi nodes, the incoming parent block should be loop1's merge block. loop1 is multiple ops away so we need while loop here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77543/new/
https://reviews.llvm.org/D77543
More information about the llvm-commits
mailing list