26 if (Local || Delete) {
56 : Named(GVs.begin(), GVs.end()), deleteStuff(deleteS),
57 keepConstInit(keepConstInit) {}
62 M.setModuleInlineAsm(
"");
73 bool Delete = deleteStuff == (
bool)Named.count(&GV) &&
74 !GV.isDeclaration() && (!GV.isConstant() || !keepConstInit);
76 if (GV.hasAvailableExternallyLinkage())
78 if (GV.getName() ==
"llvm.global_ctors")
86 GV.setInitializer(
nullptr);
87 GV.setComdat(
nullptr);
93 bool Delete = deleteStuff == (
bool)Named.count(&
F) && !
F.isDeclaration();
95 if (
F.hasAvailableExternallyLinkage())
104 F.setComdat(
nullptr);
110 bool Delete = deleteStuff == (
bool)Named.count(&GA);
114 Type *Ty = GA.getValueType();
116 GA.removeFromParent();
120 GA.getAddressSpace(), GA.getName(), &M);
126 GA.replaceAllUsesWith(Declaration);
133 bool Delete = deleteStuff == (
bool)Named.count(&IF);
139 auto *FuncType = dyn_cast<FunctionType>(IF.getValueType());
140 IF.removeFromParent();
143 IF.getAddressSpace(), IF.getName(), &M);
144 IF.replaceAllUsesWith(Declaration);
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A container for analyses that lazily runs them and caches their results.
Class to represent function types.
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
bool hasLinkOnceLinkage() const
LinkageTypes getLinkage() const
bool hasLocalLinkage() const
void setLinkage(LinkageTypes LT)
@ HiddenVisibility
The GV is hidden.
void setVisibility(VisibilityTypes V)
static bool isDiscardableIfUnused(LinkageTypes Linkage)
Whether the definition of this global may be discarded if it is not used in its compilation unit.
@ LinkOnceAnyLinkage
Keep one copy of function when linking (inline)
@ WeakODRLinkage
Same, but only replaced by something equivalent.
@ ExternalLinkage
Externally visible function.
@ WeakAnyLinkage
Keep one copy of named function when linking (weak)
@ LinkOnceODRLinkage
Same, but only replaced by something equivalent.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...