Skip to content

Commit

Permalink
Silence false-positive warnings about implicit CPU fallback. (#19907)
Browse files Browse the repository at this point in the history
In #19902 we added reporting of
errors in `LLVMCPUTargetCLOptions::getTargetOptions` which allows
reporting things like an unknown CPU before that causes assertion
failures in LLVM. But we mistakenly also reported there the warning
about the implicit CPU fallback, which is a false positive in this case
as it triggers on default targets that we may not actually use.

Signed-off-by: Benoit Jacob <[email protected]>
  • Loading branch information
bjacob authored Feb 5, 2025
1 parent 4923c53 commit 13c2964
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,13 @@ LLVMTargetOptions LLVMCPUTargetCLOptions::getTargetOptions() {
ResolveCPUAndCPUFeaturesStatus status;
std::optional<LLVMTarget> maybeTarget = LLVMTarget::create(
targetTriple, targetCPU, targetCPUFeatures, linkEmbedded, status);
if (status != ResolveCPUAndCPUFeaturesStatus::OK) {
// Only report serious errors here, not potentially verbose warnings such as
// ImplicitGenericFallback, which has false positives at this point as it
// triggers on default-constructed targets that we might not actually use.
// If the targets are used, they will trigger the warning again in
// LLVMTarget::loadFromConfigAttr.
if (status != ResolveCPUAndCPUFeaturesStatus::OK &&
status != ResolveCPUAndCPUFeaturesStatus::ImplicitGenericFallback) {
llvm::errs() << getMessage(status, targetTriple);
}
if (maybeTarget) {
Expand Down

0 comments on commit 13c2964

Please sign in to comment.