From 600b9aa8f383d71ebb9da6c48f5f30b614d72cf8 Mon Sep 17 00:00:00 2001 From: Akshat Oke Date: Wed, 26 Feb 2025 08:26:49 +0000 Subject: [PATCH 1/2] [llc] Report error in lieu of warning for invalid cl option --- llvm/tools/llc/NewPMDriver.cpp | 4 ++-- llvm/tools/llc/llc.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/tools/llc/NewPMDriver.cpp b/llvm/tools/llc/NewPMDriver.cpp index 3892fbb8c74f7..25f7245e07976 100644 --- a/llvm/tools/llc/NewPMDriver.cpp +++ b/llvm/tools/llc/NewPMDriver.cpp @@ -93,7 +93,7 @@ int llvm::compileModuleWithNewPM( CodeGenFileType FileType) { if (!PassPipeline.empty() && TargetPassConfig::hasLimitedCodeGenPipeline()) { - WithColor::warning(errs(), Arg0) + WithColor::error(errs(), Arg0) << "--passes cannot be used with " << TargetPassConfig::getLimitedCodeGenPipelineReason() << ".\n"; return 1; @@ -139,7 +139,7 @@ int llvm::compileModuleWithNewPM( // selection. if (!MIR) { - WithColor::warning(errs(), Arg0) << "-passes is for .mir file only.\n"; + WithColor::error(errs(), Arg0) << "-passes is for .mir file only.\n"; return 1; } diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index 3694ff79b5436..b01af688feb60 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -692,7 +692,7 @@ static int compileModule(char **argv, LLVMContext &Context) { // selection. if (!getRunPassNames().empty()) { if (!MIR) { - WithColor::warning(errs(), argv[0]) + WithColor::error(errs(), argv[0]) << "run-pass is for .mir file only.\n"; delete MMIWP; return 1; @@ -700,7 +700,7 @@ static int compileModule(char **argv, LLVMContext &Context) { TargetPassConfig *PTPC = Target->createPassConfig(PM); TargetPassConfig &TPC = *PTPC; if (TPC.hasLimitedCodeGenPipeline()) { - WithColor::warning(errs(), argv[0]) + WithColor::error(errs(), argv[0]) << "run-pass cannot be used with " << TPC.getLimitedCodeGenPipelineReason() << ".\n"; delete PTPC; From badad8e8734984124a2c38e4187d8e0047fc81c6 Mon Sep 17 00:00:00 2001 From: Akshat Oke Date: Mon, 10 Mar 2025 05:51:45 +0000 Subject: [PATCH 2/2] update test --- llvm/test/tools/llc/new-pm/option-conflict.ll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/test/tools/llc/new-pm/option-conflict.ll b/llvm/test/tools/llc/new-pm/option-conflict.ll index 5847a32058756..5031e950fee21 100644 --- a/llvm/test/tools/llc/new-pm/option-conflict.ll +++ b/llvm/test/tools/llc/new-pm/option-conflict.ll @@ -1,3 +1,3 @@ ; RUN: not llc -mtriple=x86_64-pc-linux-gnu -passes=foo -start-before=mergeicmps -stop-after=gc-lowering -filetype=null %s 2>&1 | FileCheck %s -; CHECK: warning: --passes cannot be used with start-before and stop-after. +; CHECK: error: --passes cannot be used with start-before and stop-after.