Skip to content

Commit

Permalink
[CPU] Return std::nullopt when failing on creating host target. (#19052)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hanhanW authored Nov 6, 2024
1 parent 411a815 commit 50f32e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ std::optional<LLVMTarget> LLVMTarget::createForHost() {
if (status != ResolveCPUAndCPUFeaturesStatus::OK) {
llvm::errs() << "Internal error while creating host target: "
<< getMessage(status, triple) << "\n";
assert(false);
return std::nullopt;
}
if (target)
target->populateDefaultsFromTargetMachine();
Expand Down

0 comments on commit 50f32e5

Please sign in to comment.