Skip to content

Commit 50f32e5

Browse files
authored
[CPU] Return std::nullopt when failing on creating host target. (#19052)
We should not have an assertion because it crashes in debug build. Given that the return type is std::optional, the caller should handle the error themselves. Otherwise, we're not able to compile any MLIR programs targeting CPUs when there are troubles in host CPU setup.
1 parent 411a815 commit 50f32e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ std::optional<LLVMTarget> LLVMTarget::createForHost() {
8282
if (status != ResolveCPUAndCPUFeaturesStatus::OK) {
8383
llvm::errs() << "Internal error while creating host target: "
8484
<< getMessage(status, triple) << "\n";
85-
assert(false);
85+
return std::nullopt;
8686
}
8787
if (target)
8888
target->populateDefaultsFromTargetMachine();

0 commit comments

Comments
 (0)