diff options
author | bd1976bris <bd1976llvm@gmail.com> | 2025-05-21 23:21:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-21 23:21:59 +0100 |
commit | b4d2e502e06fb96a124ef4c99668531a4c6abd3d (patch) | |
tree | babf56d452d5bc82ce672f01573402e7a00c59a5 /llvm/lib | |
parent | c21416d1f9363a53dc09596bfec033cc5b3a02a8 (diff) | |
download | llvm-b4d2e502e06fb96a124ef4c99668531a4c6abd3d.zip llvm-b4d2e502e06fb96a124ef4c99668531a4c6abd3d.tar.gz llvm-b4d2e502e06fb96a124ef4c99668531a4c6abd3d.tar.bz2 |
[LLVM] Use `reportFatalUsageError` for LTO usage errors (#140955)
Usage errors in `LTOBackend.cpp` were previously, misleadingly, reported
as internal crashes.
This PR updates `LTOBackend.cpp` to use `reportFatalUsageError` for
reporting usage-related issues.
LLVM Issue: https://github.com/llvm/llvm-project/issues/140953
Internal Tracker: TOOLCHAIN-17744
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index b7db70b..fcf8baf 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -290,8 +290,8 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM, if (!Conf.AAPipeline.empty()) { AAManager AA; if (auto Err = PB.parseAAPipeline(AA, Conf.AAPipeline)) { - report_fatal_error(Twine("unable to parse AA pipeline description '") + - Conf.AAPipeline + "': " + toString(std::move(Err))); + reportFatalUsageError(Twine("unable to parse AA pipeline description '") + + Conf.AAPipeline + "': " + toString(std::move(Err))); } // Register the AA manager first so that our version is the one used. FAM.registerPass([&] { return std::move(AA); }); @@ -331,8 +331,9 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM, // Parse a custom pipeline if asked to. if (!Conf.OptPipeline.empty()) { if (auto Err = PB.parsePassPipeline(MPM, Conf.OptPipeline)) { - report_fatal_error(Twine("unable to parse pass pipeline description '") + - Conf.OptPipeline + "': " + toString(std::move(Err))); + reportFatalUsageError( + Twine("unable to parse pass pipeline description '") + + Conf.OptPipeline + "': " + toString(std::move(Err))); } } else if (IsThinLTO) { MPM.addPass(PB.buildThinLTODefaultPipeline(OL, ImportSummary)); @@ -415,8 +416,8 @@ static void codegen(const Config &Conf, TargetMachine *TM, if (!Conf.DwoDir.empty()) { std::error_code EC; if (auto EC = llvm::sys::fs::create_directories(Conf.DwoDir)) - report_fatal_error(Twine("Failed to create directory ") + Conf.DwoDir + - ": " + EC.message()); + reportFatalUsageError(Twine("Failed to create directory ") + Conf.DwoDir + + ": " + EC.message()); DwoFile = Conf.DwoDir; sys::path::append(DwoFile, std::to_string(Task) + ".dwo"); @@ -428,14 +429,14 @@ static void codegen(const Config &Conf, TargetMachine *TM, std::error_code EC; DwoOut = std::make_unique<ToolOutputFile>(DwoFile, EC, sys::fs::OF_None); if (EC) - report_fatal_error(Twine("Failed to open ") + DwoFile + ": " + - EC.message()); + reportFatalUsageError(Twine("Failed to open ") + DwoFile + ": " + + EC.message()); } Expected<std::unique_ptr<CachedFileStream>> StreamOrErr = AddStream(Task, Mod.getModuleIdentifier()); if (Error Err = StreamOrErr.takeError()) - report_fatal_error(std::move(Err)); + reportFatalUsageError(std::move(Err)); std::unique_ptr<CachedFileStream> &Stream = *StreamOrErr; TM->Options.ObjectFilenameForDebug = Stream->ObjectPathName; |