[llvm] llvm-reduce: Fix taking wrong error before exit (PR #135020)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 07:05:01 PDT 2025
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/135020
This was taking the error from the first getBitcodeFileContents,
which had to have succeeded at this point. It was also ignoring
the next 2 errors.
>From 93be8a44e5b5cf644d5ac65b0ae3060d06b48edd Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 9 Apr 2025 15:20:49 +0800
Subject: [PATCH] llvm-reduce: Fix taking wrong error before exit
This was taking the error from the first getBitcodeFileContents,
which had to have succeeded at this point. It was also ignoring
the next 2 errors.
---
llvm/tools/llvm-reduce/ReducerWorkItem.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
index ad40d8d8baa36..8d2675c685038 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -757,13 +757,20 @@ void ReducerWorkItem::readBitcode(MemoryBufferRef Data, LLVMContext &Ctx,
WithColor::error(errs(), ToolName) << IF.takeError();
exit(1);
}
+
BitcodeModule BM = IF->Mods[0];
Expected<BitcodeLTOInfo> LI = BM.getLTOInfo();
+ if (!LI) {
+ WithColor::error(errs(), ToolName) << LI.takeError();
+ exit(1);
+ }
+
Expected<std::unique_ptr<Module>> MOrErr = BM.parseModule(Ctx);
- if (!LI || !MOrErr) {
- WithColor::error(errs(), ToolName) << IF.takeError();
+ if (!MOrErr) {
+ WithColor::error(errs(), ToolName) << MOrErr.takeError();
exit(1);
}
+
LTOInfo = std::make_unique<BitcodeLTOInfo>(*LI);
M = std::move(MOrErr.get());
}
More information about the llvm-commits
mailing list