From c73a33bc11ca81e463afbc3c395d50aca4ec3db7 Mon Sep 17 00:00:00 2001 From: Renato Golin Date: Thu, 4 Jul 2024 16:16:34 +0100 Subject: [PATCH] Assert doesn't get compiled in Release mode This creates a scenario where the Expected doesn't get checked and the execution crashes, even if the engine was created correctly. --- .../transformations/src/transformations/mlir/convert.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/transformations/src/transformations/mlir/convert.cpp b/src/common/transformations/src/transformations/mlir/convert.cpp index 70fe5574f4b90b..d63c4830f0b3eb 100644 --- a/src/common/transformations/src/transformations/mlir/convert.cpp +++ b/src/common/transformations/src/transformations/mlir/convert.cpp @@ -257,8 +257,12 @@ class MLIREvaluate { // in `create` independently engineOptions.llvmModuleBuilder = lowerToLLVMIR; auto maybeEngine = mlir::ExecutionEngine::create(module.get(), engineOptions); - assert(maybeEngine && "failed to construct an execution engine"); - engine = std::move(maybeEngine.get()); + if (maybeEngine) { + engine = std::move(maybeEngine.get()); + } else { + llvm::errs() << "failed to construct an execution engine\n"; + abort(); + } } bool invoke_packed(std::vector& args) {