Skip to content

Commit 13c2964

Browse files
authored
Silence false-positive warnings about implicit CPU fallback. (iree-org#19907)
In iree-org#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]>
1 parent 4923c53 commit 13c2964

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,13 @@ LLVMTargetOptions LLVMCPUTargetCLOptions::getTargetOptions() {
607607
ResolveCPUAndCPUFeaturesStatus status;
608608
std::optional<LLVMTarget> maybeTarget = LLVMTarget::create(
609609
targetTriple, targetCPU, targetCPUFeatures, linkEmbedded, status);
610-
if (status != ResolveCPUAndCPUFeaturesStatus::OK) {
610+
// Only report serious errors here, not potentially verbose warnings such as
611+
// ImplicitGenericFallback, which has false positives at this point as it
612+
// triggers on default-constructed targets that we might not actually use.
613+
// If the targets are used, they will trigger the warning again in
614+
// LLVMTarget::loadFromConfigAttr.
615+
if (status != ResolveCPUAndCPUFeaturesStatus::OK &&
616+
status != ResolveCPUAndCPUFeaturesStatus::ImplicitGenericFallback) {
611617
llvm::errs() << getMessage(status, targetTriple);
612618
}
613619
if (maybeTarget) {

0 commit comments

Comments
 (0)