[llvm] 93e6724 - [LTO] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D123803
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 5 21:08:34 PDT 2023
Author: Fangrui Song
Date: 2023-07-05T21:08:30-07:00
New Revision: 93e672489aaa59aeb98da9175fc4a43d42889ab0
URL: https://github.com/llvm/llvm-project/commit/93e672489aaa59aeb98da9175fc4a43d42889ab0
DIFF: https://github.com/llvm/llvm-project/commit/93e672489aaa59aeb98da9175fc4a43d42889ab0.diff
LOG: [LTO] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D123803
Added:
Modified:
llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
index 574874b86ffe23..fc1e70b1b3d3d8 100644
--- a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
+++ b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
@@ -259,13 +259,15 @@ static void cloneUsedGlobalVariables(const Module &SrcM, Module &DestM,
appendToUsed(DestM, NewUsed);
}
-bool enableUnifiedLTO(Module &M) {
+#ifndef NDEBUG
+static bool enableUnifiedLTO(Module &M) {
bool UnifiedLTO = false;
if (auto *MD =
mdconst::extract_or_null<ConstantInt>(M.getModuleFlag("UnifiedLTO")))
UnifiedLTO = MD->getZExtValue();
return UnifiedLTO;
}
+#endif
// If it's possible to split M into regular and thin LTO parts, do so and write
// a multi-module bitcode file with the two parts to OS. Otherwise, write only a
@@ -273,10 +275,9 @@ bool enableUnifiedLTO(Module &M) {
void splitAndWriteThinLTOBitcode(
raw_ostream &OS, raw_ostream *ThinLinkOS,
function_ref<AAResults &(Function &)> AARGetter, Module &M) {
- bool UnifiedLTO = enableUnifiedLTO(M);
std::string ModuleId = getUniqueModuleId(&M);
if (ModuleId.empty()) {
- assert(!UnifiedLTO);
+ assert(!enableUnifiedLTO(M));
// We couldn't generate a module ID for this module, write it out as a
// regular LTO module with an index for summary-based dead stripping.
ProfileSummaryInfo PSI(M);
More information about the llvm-commits
mailing list