25 if (
Local || Delete) {
55 : Named(GVs.begin(), GVs.end()), deleteStuff(deleteS),
56 keepConstInit(keepConstInit) {}
61 M.setModuleInlineAsm(
"");
72 bool Delete = deleteStuff == (
bool)Named.count(&GV) &&
73 !GV.isDeclaration() && (!GV.isConstant() || !keepConstInit);
75 if (GV.hasAvailableExternallyLinkage())
77 if (GV.getName() ==
"llvm.global_ctors")
85 GV.setInitializer(
nullptr);
86 GV.setComdat(
nullptr);
92 bool Delete = deleteStuff == (
bool)Named.count(&
F) && !
F.isDeclaration();
94 if (
F.hasAvailableExternallyLinkage())
103 F.setComdat(
nullptr);
109 bool Delete = deleteStuff == (
bool)Named.count(&GA);
113 Type *Ty = GA.getValueType();
115 GA.removeFromParent();
119 GA.getAddressSpace(), GA.getName(), &M);
125 GA.replaceAllUsesWith(Declaration);
132 bool Delete = deleteStuff == (
bool)Named.count(&IF);
138 auto *FuncType = dyn_cast<FunctionType>(IF.getValueType());
139 IF.removeFromParent();
142 IF.getAddressSpace(), IF.getName(), &M);
143 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...