22 if (!DeadFunctionsInComdats.empty()) {
24 DeadFunctions.append(DeadFunctionsInComdats.begin(),
25 DeadFunctionsInComdats.end());
30 for (
Function *DeadFn : DeadFunctions) {
31 DeadFn->removeDeadConstantUsers();
34 if (LCG && !ReplacedFunctions.count(DeadFn)) {
38 assert(DeadSCC && DeadSCC->size() == 1 &&
39 &DeadSCC->begin()->getFunction() == DeadFn);
41 FAM->
clear(*DeadFn, DeadFn->getName());
42 AM->
clear(*DeadSCC, DeadSCC->getName());
54 DeadFn->eraseFromParent();
58 bool Changed = !DeadFunctions.empty();
59 DeadFunctionsInComdats.clear();
60 DeadFunctions.clear();
82 DeadFunctionsInComdats.push_back(&DeadFn);
84 DeadFunctions.push_back(&DeadFn);
92 ReplacedFunctions.insert(&OldFn);
This file provides interfaces used to manipulate a call graph, regardless if it is a "old style" Call...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void clear(IRUnitT &IR, llvm::StringRef Name)
Clear any cached analysis results for a single unit of IR.
void registerOutlinedFunction(Function &OriginalFn, Function &NewFn)
If a new function was created by outlining, this method can be called to update the call graph for th...
void removeFunction(Function &Fn)
Remove Fn from the call graph.
void replaceFunctionWith(Function &OldFn, Function &NewFn)
Replace OldFn in the call graph (and SCC) with NewFn.
void reanalyzeFunction(Function &Fn)
After an CGSCC pass changes a function in ways that affect the call graph, this method can be called ...
void removeDeadConstantUsers() const
If there are any dead constant users dangling off of this constant, remove them.
void deleteBody()
deleteBody - This method deletes the body of the function, and converts the linkage to external.
void setLinkage(LinkageTypes LT)
@ ExternalLinkage
Externally visible function.
A node in the call graph.
void replaceNodeFunction(Node &N, Function &NewF)
Directly replace a node's function with a new function.
An SCC of the call graph.
RefSCC & getOuterRefSCC() const
void markDeadFunction(Function &F)
Mark a function as dead to be removed later by removeDeadFunctions().
void addSplitFunction(Function &OriginalFunction, Function &NewFunction)
Add a new function split/outlined from an existing function.
Node & get(Function &F)
Get a graph node for a given function, scanning it to populate the graph data as necessary.
SCC * lookupSCC(Node &N) const
Lookup a function's SCC in the graph.
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
StringRef getName() const
Return a constant reference to the value's name.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
LazyCallGraph::SCC & updateCGAndAnalysisManagerForCGSCCPass(LazyCallGraph &G, LazyCallGraph::SCC &C, LazyCallGraph::Node &N, CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR, FunctionAnalysisManager &FAM)
Helper to update the call graph after running a CGSCC pass.
void filterDeadComdatFunctions(SmallVectorImpl< Function * > &DeadComdatFunctions)
Filter out potentially dead comdat functions where other entries keep the entire comdat group alive.
SmallVector< Function *, 4 > & DeadFunctions
Functions that a pass has considered to be dead to be removed at the end of the call graph walk in ba...
SmallPtrSetImpl< LazyCallGraph::SCC * > & InvalidatedSCCs
The set of invalidated SCCs which should be skipped if they are found in CWorklist.