Using a loop init_arg inside of the loop is not supported. This change adds a pre-processing pass that resolves such IR with copies.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks for the quick fix!
| mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp | ||
|---|---|---|
| 70 | You could stop iterating after this. Or consider using llvm::any_of, that way you can get rid of the continue above as well. You might also get rid of usesInsideRegion completely, if you initialize tensorCopy lazily: Value tensorCopy;
for (OpOperand &use : ...) {
if (isProperAncestor && llvm::any_of(...)) {
if (!tensorCopy) {
tensorCopy = ...;
}
use.set(tensorCopy);
}
}Not 100% sure it's nicer though. | |
You could stop iterating after this. Or consider using llvm::any_of, that way you can get rid of the continue above as well.
You might also get rid of usesInsideRegion completely, if you initialize tensorCopy lazily:
Value tensorCopy; for (OpOperand &use : ...) { if (isProperAncestor && llvm::any_of(...)) { if (!tensorCopy) { tensorCopy = ...; } use.set(tensorCopy); } }Not 100% sure it's nicer though.