Commit f27d2fb0 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Fixed an issue with Qubit after QVS Op



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent d6e85ae9
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -294,8 +294,13 @@ LogicalResult CreateCallableOpLowering::matchAndRewrite(
                    LLVM::LLVMPointerType::get(tuple_struct_type_list[idx]),
                    structPtr, ArrayRef<Value>({zero_cst, idx_cst}))
                .res();
        auto store_op = rewriter.create<LLVM::StoreOp>(
            location, create_callable_op.captures()[idx], field_ptr);
        auto captured_value = create_callable_op.captures()[idx];
        if (auto q_op =
                captured_value
                    .getDefiningOp<mlir::quantum::ValueSemanticsInstOp>()) {
          captured_value = q_op.getOperands()[0];
        }
        rewriter.create<LLVM::StoreOp>(location, captured_value, field_ptr);
      }

      return tuplePtr;