Skip to content

Commit 1e9f46c

Browse files
authored
llvm-reduce: Fix taking wrong error before exit (#135020)
1 parent b6f4ec7 commit 1e9f46c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

llvm/tools/llvm-reduce/ReducerWorkItem.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,13 +757,20 @@ void ReducerWorkItem::readBitcode(MemoryBufferRef Data, LLVMContext &Ctx,
757757
WithColor::error(errs(), ToolName) << IF.takeError();
758758
exit(1);
759759
}
760+
760761
BitcodeModule BM = IF->Mods[0];
761762
Expected<BitcodeLTOInfo> LI = BM.getLTOInfo();
763+
if (!LI) {
764+
WithColor::error(errs(), ToolName) << LI.takeError();
765+
exit(1);
766+
}
767+
762768
Expected<std::unique_ptr<Module>> MOrErr = BM.parseModule(Ctx);
763-
if (!LI || !MOrErr) {
764-
WithColor::error(errs(), ToolName) << IF.takeError();
769+
if (!MOrErr) {
770+
WithColor::error(errs(), ToolName) << MOrErr.takeError();
765771
exit(1);
766772
}
773+
767774
LTOInfo = std::make_unique<BitcodeLTOInfo>(*LI);
768775
M = std::move(MOrErr.get());
769776
}

0 commit comments

Comments
 (0)