diff --git a/CHANGELOG.md b/CHANGELOG.md index 57fac2a66..5f7a707a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel ### Added -- ✨ Add initial infrastructure for new QC and QCO MLIR dialects ([#1264], [#1402], [#1428], [#1430], [#1436], [#1443], [#1446]) ([**@burgholzer**], [**@denialhaag**], [**@taminob**], [**@DRovara**]) +- ✨ Add initial infrastructure for new QC and QCO MLIR dialects ([#1264], [#1402], [#1428], [#1430], [#1436], [#1443], [#1446], [#1465]) ([**@burgholzer**], [**@denialhaag**], [**@taminob**], [**@DRovara**], [**@li-mingbao**]) ### Changed @@ -314,6 +314,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool +[#1465]: https://github.com/munich-quantum-toolkit/core/pull/1465 [#1458]: https://github.com/munich-quantum-toolkit/core/pull/1458 [#1453]: https://github.com/munich-quantum-toolkit/core/pull/1453 [#1447]: https://github.com/munich-quantum-toolkit/core/pull/1447 diff --git a/mlir/include/mlir/Dialect/Utils/Utils.h b/mlir/include/mlir/Dialect/Utils/Utils.h index 1674c5779..beb92519d 100644 --- a/mlir/include/mlir/Dialect/Utils/Utils.h +++ b/mlir/include/mlir/Dialect/Utils/Utils.h @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include @@ -20,25 +20,33 @@ namespace mlir::utils { constexpr auto TOLERANCE = 1e-15; +inline Value constantFromScalar(OpBuilder& builder, Location loc, double v) { + return arith::ConstantOp::create(builder, loc, builder.getF64FloatAttr(v)); +} + +inline Value constantFromScalar(OpBuilder& builder, Location loc, int64_t v) { + return arith::ConstantOp::create(builder, loc, builder.getIndexAttr(v)); +} + +inline Value constantFromScalar(OpBuilder& builder, Location loc, bool v) { + return arith::ConstantOp::create(builder, loc, builder.getBoolAttr(v)); +} + /** - * @brief Convert a variant parameter (double or Value) to a Value + * @brief Convert a variant parameter (T or Value) to a Value. * * @param builder The operation builder. - * @param state The operation state. - * @param parameter The parameter as a variant (double or Value). + * @param loc The location of the operation. + * @param parameter The parameter as a variant (T or Value). * @return Value The parameter as a Value. */ -[[nodiscard]] inline Value -variantToValue(OpBuilder& builder, const OperationState& state, - const std::variant& parameter) { - Value operand; - if (std::holds_alternative(parameter)) { - operand = builder.create( - state.location, builder.getF64FloatAttr(std::get(parameter))); - } else { - operand = std::get(parameter); +template +[[nodiscard]] Value variantToValue(OpBuilder& builder, Location loc, + const std::variant& parameter) { + if (std::holds_alternative(parameter)) { + return std::get(parameter); } - return operand; + return constantFromScalar(builder, loc, std::get(parameter)); } /** diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/GPhaseOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/GPhaseOp.cpp index 02e84385c..515c093f7 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/GPhaseOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/GPhaseOp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void GPhaseOp::build(OpBuilder& builder, OperationState& state, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/POp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/POp.cpp index e221b63cd..2a0c8cfbd 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/POp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/POp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void POp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubitIn, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/ROp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/ROp.cpp index 9301c79eb..5d0270296 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/ROp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/ROp.cpp @@ -22,7 +22,7 @@ using namespace mlir::utils; void ROp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta, const std::variant& phi) { - auto thetaOperand = variantToValue(builder, state, theta); - auto phiOperand = variantToValue(builder, state, phi); + auto thetaOperand = variantToValue(builder, state.location, theta); + auto phiOperand = variantToValue(builder, state.location, phi); build(builder, state, qubitIn, thetaOperand, phiOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RXOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RXOp.cpp index 5ef1b019e..bc1cdaee9 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RXOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RXOp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void RXOp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubitIn, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RXXOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RXXOp.cpp index bd16fd722..2f8488897 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RXXOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RXXOp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void RXXOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubit0In, qubit1In, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RYOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RYOp.cpp index 1b61b88ac..dcce9a0ed 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RYOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RYOp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void RYOp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubitIn, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RYYOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RYYOp.cpp index ef8defe3a..ba744bac6 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RYYOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RYYOp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void RYYOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubit0In, qubit1In, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZOp.cpp index 082dd8c88..67593b975 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZOp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void RZOp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubitIn, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZXOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZXOp.cpp index 44a202065..db9e6124d 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZXOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZXOp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void RZXOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubit0In, qubit1In, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZZOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZZOp.cpp index 48e26c9eb..27beb91d7 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZZOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/RZZOp.cpp @@ -21,6 +21,6 @@ using namespace mlir::utils; void RZZOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubit0In, qubit1In, thetaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/U2Op.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/U2Op.cpp index b7d4ea7a7..cfb4d344b 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/U2Op.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/U2Op.cpp @@ -22,7 +22,7 @@ using namespace mlir::utils; void U2Op::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& phi, const std::variant& lambda) { - auto phiOperand = variantToValue(builder, state, phi); - auto lambdaOperand = variantToValue(builder, state, lambda); + auto phiOperand = variantToValue(builder, state.location, phi); + auto lambdaOperand = variantToValue(builder, state.location, lambda); build(builder, state, qubitIn, phiOperand, lambdaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/UOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/UOp.cpp index 3a2f860c0..80a6a6f93 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/UOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/UOp.cpp @@ -23,8 +23,8 @@ void UOp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta, const std::variant& phi, const std::variant& lambda) { - auto thetaOperand = variantToValue(builder, state, theta); - auto phiOperand = variantToValue(builder, state, phi); - auto lambdaOperand = variantToValue(builder, state, lambda); + auto thetaOperand = variantToValue(builder, state.location, theta); + auto phiOperand = variantToValue(builder, state.location, phi); + auto lambdaOperand = variantToValue(builder, state.location, lambda); build(builder, state, qubitIn, thetaOperand, phiOperand, lambdaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/XXMinusYYOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/XXMinusYYOp.cpp index 2a43925fb..957005643 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/XXMinusYYOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/XXMinusYYOp.cpp @@ -23,7 +23,7 @@ void XXMinusYYOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta, const std::variant& beta) { - auto thetaOperand = variantToValue(builder, state, theta); - auto betaOperand = variantToValue(builder, state, beta); + auto thetaOperand = variantToValue(builder, state.location, theta); + auto betaOperand = variantToValue(builder, state.location, beta); build(builder, state, qubit0In, qubit1In, thetaOperand, betaOperand); } diff --git a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/XXPlusYYOp.cpp b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/XXPlusYYOp.cpp index 737df244e..f45286c94 100644 --- a/mlir/lib/Dialect/QC/IR/Operations/StandardGates/XXPlusYYOp.cpp +++ b/mlir/lib/Dialect/QC/IR/Operations/StandardGates/XXPlusYYOp.cpp @@ -23,7 +23,7 @@ void XXPlusYYOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta, const std::variant& beta) { - auto thetaOperand = variantToValue(builder, state, theta); - auto betaOperand = variantToValue(builder, state, beta); + auto thetaOperand = variantToValue(builder, state.location, theta); + auto betaOperand = variantToValue(builder, state.location, beta); build(builder, state, qubit0In, qubit1In, thetaOperand, betaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/GPhaseOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/GPhaseOp.cpp index a9f978199..b1f1e497b 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/GPhaseOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/GPhaseOp.cpp @@ -47,7 +47,7 @@ struct RemoveTrivialGPhase final : OpRewritePattern { void GPhaseOp::build(OpBuilder& builder, OperationState& state, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/POp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/POp.cpp index 6ef68dfc6..3052d692e 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/POp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/POp.cpp @@ -54,7 +54,7 @@ struct RemoveTrivialP final : OpRewritePattern { void POp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubitIn, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/ROp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/ROp.cpp index 2f798d1e0..b9f5d510e 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/ROp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/ROp.cpp @@ -73,8 +73,8 @@ struct ReplaceRWithRY final : OpRewritePattern { void ROp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta, const std::variant& phi) { - auto thetaOperand = variantToValue(builder, state, theta); - auto phiOperand = variantToValue(builder, state, phi); + auto thetaOperand = variantToValue(builder, state.location, theta); + auto phiOperand = variantToValue(builder, state.location, phi); build(builder, state, qubitIn, thetaOperand, phiOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RXOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RXOp.cpp index abaaa2657..9245007c9 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RXOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RXOp.cpp @@ -54,7 +54,7 @@ struct RemoveTrivialRX final : OpRewritePattern { void RXOp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubitIn, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RXXOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RXXOp.cpp index 27c6564c5..5924bbcb7 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RXXOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RXXOp.cpp @@ -54,7 +54,7 @@ struct RemoveTrivialRXX final : OpRewritePattern { void RXXOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubit0In, qubit1In, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RYOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RYOp.cpp index ae1beb94f..1ae0e3de0 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RYOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RYOp.cpp @@ -54,7 +54,7 @@ struct RemoveTrivialRY final : OpRewritePattern { void RYOp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubitIn, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RYYOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RYYOp.cpp index 92515aea5..7b181a91c 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RYYOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RYYOp.cpp @@ -54,7 +54,7 @@ struct RemoveTrivialRYY final : OpRewritePattern { void RYYOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubit0In, qubit1In, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZOp.cpp index 913112c49..2ca6092f7 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZOp.cpp @@ -54,7 +54,7 @@ struct RemoveTrivialRZ final : OpRewritePattern { void RZOp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubitIn, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZXOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZXOp.cpp index dfc48d070..4b2b3a471 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZXOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZXOp.cpp @@ -54,7 +54,7 @@ struct RemoveTrivialRZX final : OpRewritePattern { void RZXOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubit0In, qubit1In, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZZOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZZOp.cpp index 041308030..728c8e0aa 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZZOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/RZZOp.cpp @@ -54,7 +54,7 @@ struct RemoveTrivialRZZ final : OpRewritePattern { void RZZOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta) { - auto thetaOperand = variantToValue(builder, state, theta); + auto thetaOperand = variantToValue(builder, state.location, theta); build(builder, state, qubit0In, qubit1In, thetaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/U2Op.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/U2Op.cpp index ced629792..b7fc3e6fd 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/U2Op.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/U2Op.cpp @@ -99,8 +99,8 @@ struct ReplaceU2WithRY final : OpRewritePattern { void U2Op::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& phi, const std::variant& lambda) { - auto phiOperand = variantToValue(builder, state, phi); - auto lambdaOperand = variantToValue(builder, state, lambda); + auto phiOperand = variantToValue(builder, state.location, phi); + auto lambdaOperand = variantToValue(builder, state.location, lambda); build(builder, state, qubitIn, phiOperand, lambdaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/UOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/UOp.cpp index fcf69025a..b8fd4dd42 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/UOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/UOp.cpp @@ -101,9 +101,9 @@ void UOp::build(OpBuilder& builder, OperationState& state, Value qubitIn, const std::variant& theta, const std::variant& phi, const std::variant& lambda) { - auto thetaOperand = variantToValue(builder, state, theta); - auto phiOperand = variantToValue(builder, state, phi); - auto lambdaOperand = variantToValue(builder, state, lambda); + auto thetaOperand = variantToValue(builder, state.location, theta); + auto phiOperand = variantToValue(builder, state.location, phi); + auto lambdaOperand = variantToValue(builder, state.location, lambda); build(builder, state, qubitIn, thetaOperand, phiOperand, lambdaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXMinusYYOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXMinusYYOp.cpp index 4a45be0bc..ebc743c4b 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXMinusYYOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXMinusYYOp.cpp @@ -75,8 +75,8 @@ void XXMinusYYOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta, const std::variant& beta) { - auto thetaOperand = variantToValue(builder, state, theta); - auto betaOperand = variantToValue(builder, state, beta); + auto thetaOperand = variantToValue(builder, state.location, theta); + auto betaOperand = variantToValue(builder, state.location, beta); build(builder, state, qubit0In, qubit1In, thetaOperand, betaOperand); } diff --git a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXPlusYYOp.cpp b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXPlusYYOp.cpp index 3574f41e9..02a1d493a 100644 --- a/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXPlusYYOp.cpp +++ b/mlir/lib/Dialect/QCO/IR/Operations/StandardGates/XXPlusYYOp.cpp @@ -75,8 +75,8 @@ void XXPlusYYOp::build(OpBuilder& builder, OperationState& state, Value qubit0In, Value qubit1In, const std::variant& theta, const std::variant& beta) { - auto thetaOperand = variantToValue(builder, state, theta); - auto betaOperand = variantToValue(builder, state, beta); + auto thetaOperand = variantToValue(builder, state.location, theta); + auto betaOperand = variantToValue(builder, state.location, beta); build(builder, state, qubit0In, qubit1In, thetaOperand, betaOperand); }