[llvm] r280503 - [lib/LTO] Simplify. No functional change intended.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 2 09:37:31 PDT 2016
Author: davide
Date: Fri Sep 2 11:37:31 2016
New Revision: 280503
URL: http://llvm.org/viewvc/llvm-project?rev=280503&view=rev
Log:
[lib/LTO] Simplify. No functional change intended.
Modified:
llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=280503&r1=280502&r2=280503&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Fri Sep 2 11:37:31 2016
@@ -374,21 +374,16 @@ void LTOCodeGenerator::preserveDiscardab
}
llvm::Type *i8PTy = llvm::Type::getInt8PtrTy(TheModule.getContext());
auto mayPreserveGlobal = [&](GlobalValue &GV) {
- if (!GV.isDiscardableIfUnused() || GV.isDeclaration())
+ if (!GV.isDiscardableIfUnused() || GV.isDeclaration() ||
+ !mustPreserveGV(GV))
return;
- if (!mustPreserveGV(GV))
- return;
- if (GV.hasAvailableExternallyLinkage()) {
- emitWarning(
+ if (GV.hasAvailableExternallyLinkage())
+ return emitWarning(
(Twine("Linker asked to preserve available_externally global: '") +
GV.getName() + "'").str());
- return;
- }
- if (GV.hasInternalLinkage()) {
- emitWarning((Twine("Linker asked to preserve internal global: '") +
+ if (GV.hasInternalLinkage())
+ return emitWarning((Twine("Linker asked to preserve internal global: '") +
GV.getName() + "'").str());
- return;
- }
UsedValuesSet.insert(ConstantExpr::getBitCast(&GV, i8PTy));
};
for (auto &GV : TheModule)
More information about the llvm-commits
mailing list