Skip to content

Commit 851da60

Browse files
authored
Revert "[LLVM] Use reportFatalUsageError for LTO usage errors" (#141000)
The PR causes check-lld fail: >TEST 'lld :: COFF/lto-cache-errors.ll' Tested on local revert and pass the check. Reverts #140955
1 parent 6074d83 commit 851da60

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

lld/test/COFF/lto-cache-errors.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
; RUN: rm -Rf %t.cache && mkdir %t.cache
88
; RUN: chmod 444 %t.cache
99

10-
;; Check fatal usage error emitted when the cache dir can't be created.
11-
; RUN: not lld-link /lldltocache:%t.cache/nonexistant/ /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck %s
10+
;; Check emit warnings when we can't create the cache dir
11+
; RUN: not --crash lld-link /lldltocache:%t.cache/nonexistant/ /out:%t3 /entry:main %t2.o %t.o 2>&1 | FileCheck %s
1212
; CHECK: LLVM ERROR: can't create cache directory {{.*}}/nonexistant/: Permission denied
1313

1414
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

lld/test/ELF/lto/ltopasses-custom.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ define void @barrier() {
2424
; ATOMIC-NEXT: ret void
2525

2626
; Check that invalid passes are rejected gracefully.
27-
; RUN: env LLD_IN_TEST=1 not ld.lld -m elf_x86_64 %t.o -o /dev/null \
27+
; RUN: env LLD_IN_TEST=1 not --crash ld.lld -m elf_x86_64 %t.o -o /dev/null \
2828
; RUN: --lto-newpm-passes=iamnotapass -shared 2>&1 | \
2929
; RUN: FileCheck %s --check-prefix=INVALID
3030
; INVALID: unable to parse pass pipeline description 'iamnotapass': unknown pass name 'iamnotapass'
3131

3232
; Check that invalid AA pipelines are rejected gracefully.
33-
; RUN: env LLD_IN_TEST=1 not ld.lld -m elf_x86_64 %t.o -o /dev/null \
33+
; RUN: env LLD_IN_TEST=1 not --crash ld.lld -m elf_x86_64 %t.o -o /dev/null \
3434
; RUN: --lto-newpm-passes=globaldce --lto-aa-pipeline=patatino \
3535
; RUN: -shared 2>&1 | \
3636
; RUN: FileCheck %s --check-prefix=INVALIDAA

llvm/lib/LTO/LTOBackend.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
290290
if (!Conf.AAPipeline.empty()) {
291291
AAManager AA;
292292
if (auto Err = PB.parseAAPipeline(AA, Conf.AAPipeline)) {
293-
reportFatalUsageError(Twine("unable to parse AA pipeline description '") +
294-
Conf.AAPipeline + "': " + toString(std::move(Err)));
293+
report_fatal_error(Twine("unable to parse AA pipeline description '") +
294+
Conf.AAPipeline + "': " + toString(std::move(Err)));
295295
}
296296
// Register the AA manager first so that our version is the one used.
297297
FAM.registerPass([&] { return std::move(AA); });
@@ -331,9 +331,8 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
331331
// Parse a custom pipeline if asked to.
332332
if (!Conf.OptPipeline.empty()) {
333333
if (auto Err = PB.parsePassPipeline(MPM, Conf.OptPipeline)) {
334-
reportFatalUsageError(
335-
Twine("unable to parse pass pipeline description '") +
336-
Conf.OptPipeline + "': " + toString(std::move(Err)));
334+
report_fatal_error(Twine("unable to parse pass pipeline description '") +
335+
Conf.OptPipeline + "': " + toString(std::move(Err)));
337336
}
338337
} else if (IsThinLTO) {
339338
MPM.addPass(PB.buildThinLTODefaultPipeline(OL, ImportSummary));
@@ -416,8 +415,8 @@ static void codegen(const Config &Conf, TargetMachine *TM,
416415
if (!Conf.DwoDir.empty()) {
417416
std::error_code EC;
418417
if (auto EC = llvm::sys::fs::create_directories(Conf.DwoDir))
419-
reportFatalUsageError(Twine("Failed to create directory ") + Conf.DwoDir +
420-
": " + EC.message());
418+
report_fatal_error(Twine("Failed to create directory ") + Conf.DwoDir +
419+
": " + EC.message());
421420

422421
DwoFile = Conf.DwoDir;
423422
sys::path::append(DwoFile, std::to_string(Task) + ".dwo");
@@ -429,14 +428,14 @@ static void codegen(const Config &Conf, TargetMachine *TM,
429428
std::error_code EC;
430429
DwoOut = std::make_unique<ToolOutputFile>(DwoFile, EC, sys::fs::OF_None);
431430
if (EC)
432-
reportFatalUsageError(Twine("Failed to open ") + DwoFile + ": " +
433-
EC.message());
431+
report_fatal_error(Twine("Failed to open ") + DwoFile + ": " +
432+
EC.message());
434433
}
435434

436435
Expected<std::unique_ptr<CachedFileStream>> StreamOrErr =
437436
AddStream(Task, Mod.getModuleIdentifier());
438437
if (Error Err = StreamOrErr.takeError())
439-
reportFatalUsageError(std::move(Err));
438+
report_fatal_error(std::move(Err));
440439
std::unique_ptr<CachedFileStream> &Stream = *StreamOrErr;
441440
TM->Options.ObjectFilenameForDebug = Stream->ObjectPathName;
442441

llvm/test/tools/llvm-lto2/X86/pipeline.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ define void @patatino() {
2828
; CUSTOM-NEXT: }
2929

3030
; Check that invalid pipelines are caught as errors.
31-
; RUN: not llvm-lto2 run %t1.bc -o %t.o \
31+
; RUN: not --crash llvm-lto2 run %t1.bc -o %t.o \
3232
; RUN: -r %t1.bc,patatino,px -opt-pipeline foogoo 2>&1 | \
3333
; RUN: FileCheck %s --check-prefix=ERR
3434

3535
; ERR: LLVM ERROR: unable to parse pass pipeline description 'foogoo': unknown pass name 'foogoo'
3636

37-
; RUN: not llvm-lto2 run %t1.bc -o %t.o \
37+
; RUN: not --crash llvm-lto2 run %t1.bc -o %t.o \
3838
; RUN: -r %t1.bc,patatino,px -aa-pipeline patatino \
3939
; RUN: -opt-pipeline lower-atomic 2>&1 | \
4040
; RUN: FileCheck %s --check-prefix=AAERR

0 commit comments

Comments
 (0)