summaryrefslogtreecommitdiff
path: root/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp')
-rw-r--r--mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index adda7ce6fc6c..3146e65a1d96 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -3423,12 +3423,18 @@ void OpEmitter::genSideEffectInterfaceMethods() {
}
} else {
// Otherwise this is an operand/result, so we need to attach the Value.
- body << " for (::mlir::Value value : getODS"
- << (location.kind == EffectKind::Operand ? "Operands" : "Results")
- << "(" << location.index << "))\n "
- << llvm::formatv(addEffectCode, effect, "value, ", stage,
- effectOnFullRegion, resource)
- .str();
+ body << " {\n auto valueRange = getODS"
+ << (location.kind == EffectKind::Operand ? "Operand" : "Result")
+ << "IndexAndLength(" << location.index << ");\n"
+ << " for (unsigned idx = valueRange.first; idx < "
+ "valueRange.first"
+ << " + valueRange.second; idx++) {\n "
+ << llvm::formatv(addEffectCode, effect,
+ (location.kind == EffectKind::Operand
+ ? "&getOperation()->getOpOperand(idx), "
+ : "getOperation()->getOpResult(idx), "),
+ stage, effectOnFullRegion, resource)
+ << " }\n }\n";
}
}
}