From 7ac5f99575c3040f16f86b1140c8286c742b31ba Mon Sep 17 00:00:00 2001 From: Brian Donovan <1385694+bcdonovan@users.noreply.github.com> Date: Mon, 20 May 2024 09:43:28 -0400 Subject: [PATCH] Fix handling cast without parameter (#328) --- lib/Conversion/QUIRToPulse/QUIRToPulse.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Conversion/QUIRToPulse/QUIRToPulse.cpp b/lib/Conversion/QUIRToPulse/QUIRToPulse.cpp index af865b07b..8b65fc517 100644 --- a/lib/Conversion/QUIRToPulse/QUIRToPulse.cpp +++ b/lib/Conversion/QUIRToPulse/QUIRToPulse.cpp @@ -542,6 +542,12 @@ mlir::Value QUIRToPulsePass::convertAngleToF64(Operation *angleOp, paramCastOp->getLoc(), builder.getF64Type(), paramCastOp.getRes()); angleCastedOp->moveAfter(paramCastOp); classicalQUIROpLocToConvertedPulseOpMap[angleLocHash] = angleCastedOp; + } else if (auto constOp = + dyn_cast(castOpArg.getDefiningOp())) { + // if cast from float64 then use directly + assert(constOp.getType() == builder.getF64Type() && + "expected angle type to be float 64"); + classicalQUIROpLocToConvertedPulseOpMap[angleLocHash] = constOp; } else llvm_unreachable("castOp arg unknown"); } else