[Mlir-commits] [mlir] [mlir][LLVM] Add operand bundle support (PR #108933)
Tobias Gysi
llvmlistbot at llvm.org
Tue Sep 24 06:24:40 PDT 2024
================
@@ -102,6 +102,40 @@ getOverloadedDeclaration(CallIntrinsicOp op, llvm::Intrinsic::ID id,
return llvm::Intrinsic::getDeclaration(module, id, overloadedArgTysRef);
}
+static llvm::OperandBundleDef
+convertOperandBundle(OperandRange bundleOperands, StringRef bundleTag,
+ LLVM::ModuleTranslation &moduleTranslation) {
+ std::vector<llvm::Value *> operands;
+ operands.reserve(bundleOperands.size());
+ for (Value bundleArg : bundleOperands)
+ operands.push_back(moduleTranslation.lookupValue(bundleArg));
+ return llvm::OperandBundleDef(bundleTag.str(), std::move(operands));
+}
+
+static SmallVector<llvm::OperandBundleDef>
+convertOperandBundles(OperandRangeRange bundleOperands,
+ ArrayRef<std::string> bundleTags,
+ LLVM::ModuleTranslation &moduleTranslation) {
+ assert(bundleOperands.size() == bundleTags.size() &&
+ "operand bundles and tags do not match");
+
+ SmallVector<llvm::OperandBundleDef> bundles;
+ bundles.reserve(bundleOperands.size());
+
+ for (auto [operands, tag] : llvm::zip(bundleOperands, bundleTags))
----------------
gysit wrote:
nit: We may use zip_equal here as well except that assert message will help debugging in the future.
https://github.com/llvm/llvm-project/pull/108933
More information about the Mlir-commits
mailing list