39 #define DEBUG_TYPE "functionattrs"
41 STATISTIC(NumReadNone,
"Number of functions marked readnone");
42 STATISTIC(NumReadOnly,
"Number of functions marked readonly");
43 STATISTIC(NumNoCapture,
"Number of arguments marked nocapture");
44 STATISTIC(NumReturned,
"Number of arguments marked returned");
45 STATISTIC(NumReadNoneArg,
"Number of arguments marked readnone");
46 STATISTIC(NumReadOnlyArg,
"Number of arguments marked readonly");
47 STATISTIC(NumNoAlias,
"Number of function returns marked noalias");
48 STATISTIC(NumNonNullReturn,
"Number of function returns marked nonnull");
49 STATISTIC(NumNoRecurse,
"Number of functions marked as norecurse");
56 cl::desc(
"Try to propagate nonnull argument attributes from callsites to "
57 "caller functions."));
73 const SCCNodeSet &SCCNodes) {
88 bool ReadsMemory =
false;
144 }
else if (
LoadInst *LI = dyn_cast<LoadInst>(I)) {
146 if (!LI->isVolatile()) {
151 }
else if (
StoreInst *
SI = dyn_cast<StoreInst>(I)) {
153 if (!
SI->isVolatile()) {
158 }
else if (
VAArgInst *
VI = dyn_cast<VAArgInst>(I)) {
184 template <
typename AARGetterT>
185 static bool addReadAttrs(
const SCCNodeSet &SCCNodes, AARGetterT &&AARGetter) {
188 bool ReadsMemory =
false;
211 bool MadeChange =
false;
213 if (
F->doesNotAccessMemory())
217 if (
F->onlyReadsMemory() && ReadsMemory)
224 F->removeFnAttr(Attribute::ReadOnly);
225 F->removeFnAttr(Attribute::ReadNone);
228 F->addFnAttr(ReadsMemory ? Attribute::ReadOnly : Attribute::ReadNone);
243 struct ArgumentGraphNode {
248 class ArgumentGraph {
251 typedef std::map<Argument *, ArgumentGraphNode> ArgumentMapTy;
253 ArgumentMapTy ArgumentMap;
261 ArgumentGraphNode SyntheticRoot;
264 ArgumentGraph() { SyntheticRoot.Definition =
nullptr; }
268 iterator
begin() {
return SyntheticRoot.Uses.
begin(); }
269 iterator
end() {
return SyntheticRoot.Uses.
end(); }
270 ArgumentGraphNode *getEntryNode() {
return &SyntheticRoot; }
272 ArgumentGraphNode *operator[](
Argument *
A) {
273 ArgumentGraphNode &Node = ArgumentMap[
A];
275 SyntheticRoot.Uses.push_back(&Node);
284 ArgumentUsesTracker(
const SCCNodeSet &SCCNodes)
285 : Captured(
false), SCCNodes(SCCNodes) {}
287 void tooManyUses()
override { Captured =
true; }
289 bool captured(
const Use *U)
override {
291 if (!
CS.getInstruction()) {
307 std::distance(const_cast<const Use *>(
CS.arg_begin()), U);
309 assert(UseIndex <
CS.data_operands_size() &&
310 "Indirect function calls should have been filtered above!");
312 if (UseIndex >=
CS.getNumArgOperands()) {
314 assert(
CS.hasOperandBundles() &&
"Must be!");
325 assert(F->
isVarArg() &&
"More params than args in non-varargs call");
330 Uses.push_back(&*std::next(F->
arg_begin(), UseIndex));
337 const SCCNodeSet &SCCNodes;
347 static ChildIteratorType
child_begin(NodeRef
N) {
return N->Uses.begin(); }
348 static ChildIteratorType
child_end(NodeRef
N) {
return N->Uses.end(); }
380 while (!Worklist.
empty()) {
385 case Instruction::BitCast:
386 case Instruction::GetElementPtr:
387 case Instruction::PHI:
389 case Instruction::AddrSpaceCast:
392 if (Visited.
insert(&UU).second)
397 case Instruction::Invoke: {
398 bool Captures =
true;
403 auto AddUsersToWorklistIfCapturing = [&] {
406 if (Visited.
insert(&UU).second)
412 AddUsersToWorklistIfCapturing();
420 AddUsersToWorklistIfCapturing();
430 unsigned UseIndex = std::distance(CS.
arg_begin(), U);
437 "Data operand use expected!");
441 if (UseIndex >= F->
arg_size() && !IsOperandBundleUse) {
442 assert(F->
isVarArg() &&
"More params than args in non-varargs call");
452 if (IsOperandBundleUse ||
464 AddUsersToWorklistIfCapturing();
477 case Instruction::ICmp:
486 return IsRead ? Attribute::ReadOnly : Attribute::ReadNone;
491 bool Changed =
false;
506 [](
const Argument &Arg) {
return Arg.hasReturnedAttr(); }))
509 auto FindRetArg = [&]() ->
Value * {
510 Value *RetArg =
nullptr;
512 if (
auto *
Ret = dyn_cast<ReturnInst>(BB.getTerminator())) {
515 Value *RetVal =
Ret->getReturnValue()->stripPointerCasts();
516 if (!isa<Argument>(RetVal) || RetVal->
getType() != F->getReturnType())
521 else if (RetArg != RetVal)
528 if (
Value *RetArg = FindRetArg()) {
529 auto *
A = cast<Argument>(RetArg);
530 A->addAttr(Attribute::Returned);
547 bool Changed =
false;
559 if (
auto *CalledFunc = CS.getCalledFunction()) {
560 for (
auto &CSArg : CalledFunc->args()) {
561 if (!CSArg.hasNonNullAttr())
568 if (FArg && !FArg->hasNonNullAttr()) {
569 FArg->addAttr(Attribute::NonNull);
584 bool Changed =
false;
605 if (
A->getType()->isPointerTy() && !
A->hasNoCaptureAttr()) {
606 A->addAttr(Attribute::NoCapture);
616 if (!
A->getType()->isPointerTy())
618 bool HasNonLocalUses =
false;
619 if (!
A->hasNoCaptureAttr()) {
620 ArgumentUsesTracker Tracker(SCCNodes);
622 if (!Tracker.Captured) {
623 if (Tracker.Uses.empty()) {
625 A->addAttr(Attribute::NoCapture);
632 ArgumentGraphNode *Node = AG[&*
A];
634 Node->Uses.push_back(AG[Use]);
636 HasNonLocalUses =
true;
642 if (!HasNonLocalUses && !
A->onlyReadsMemory()) {
653 R == Attribute::ReadOnly ? ++NumReadOnlyArg : ++NumReadNoneArg;
667 const std::vector<ArgumentGraphNode *> &ArgumentSCC = *
I;
668 if (ArgumentSCC.size() == 1) {
669 if (!ArgumentSCC[0]->Definition)
673 if (ArgumentSCC[0]->Uses.size() == 1 &&
674 ArgumentSCC[0]->Uses[0] == ArgumentSCC[0]) {
675 Argument *
A = ArgumentSCC[0]->Definition;
676 A->
addAttr(Attribute::NoCapture);
683 bool SCCCaptured =
false;
684 for (
auto I = ArgumentSCC.begin(),
E = ArgumentSCC.end();
685 I !=
E && !SCCCaptured; ++
I) {
686 ArgumentGraphNode *Node = *
I;
687 if (Node->Uses.empty()) {
688 if (!Node->Definition->hasNoCaptureAttr())
698 for (ArgumentGraphNode *
I : ArgumentSCC) {
699 ArgumentSCCNodes.
insert(
I->Definition);
702 for (
auto I = ArgumentSCC.begin(),
E = ArgumentSCC.end();
703 I !=
E && !SCCCaptured; ++
I) {
704 ArgumentGraphNode *
N = *
I;
705 for (ArgumentGraphNode *
Use : N->Uses) {
716 for (
unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) {
717 Argument *
A = ArgumentSCC[i]->Definition;
718 A->
addAttr(Attribute::NoCapture);
735 for (
unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) {
736 Argument *
A = ArgumentSCC[i]->Definition;
738 if (K == Attribute::ReadNone)
740 if (K == Attribute::ReadOnly) {
741 ReadAttr = Attribute::ReadOnly;
749 for (
unsigned i = 0, e = ArgumentSCC.size(); i != e; ++i) {
750 Argument *
A = ArgumentSCC[i]->Definition;
755 ReadAttr == Attribute::ReadOnly ? ++NumReadOnlyArg : ++NumReadNoneArg;
771 if (
ReturnInst *
Ret = dyn_cast<ReturnInst>(BB.getTerminator()))
772 FlowsToReturn.
insert(
Ret->getReturnValue());
774 for (
unsigned i = 0; i != FlowsToReturn.
size(); ++i) {
775 Value *RetVal = FlowsToReturn[i];
777 if (
Constant *
C = dyn_cast<Constant>(RetVal)) {
778 if (!
C->isNullValue() && !isa<UndefValue>(
C))
784 if (isa<Argument>(RetVal))
787 if (
Instruction *RVI = dyn_cast<Instruction>(RetVal))
788 switch (RVI->getOpcode()) {
790 case Instruction::BitCast:
791 case Instruction::GetElementPtr:
792 case Instruction::AddrSpaceCast:
793 FlowsToReturn.
insert(RVI->getOperand(0));
801 case Instruction::PHI: {
802 PHINode *PN = cast<PHINode>(RVI);
804 FlowsToReturn.
insert(IncValue);
809 case Instruction::Alloca:
812 case Instruction::Invoke: {
855 bool MadeChange =
false;
879 "nonnull only meaningful on pointer types");
884 if (
auto *
Ret = dyn_cast<ReturnInst>(BB.getTerminator()))
885 FlowsToReturn.
insert(
Ret->getReturnValue());
887 for (
unsigned i = 0; i != FlowsToReturn.
size(); ++i) {
888 Value *RetVal = FlowsToReturn[i];
901 case Instruction::BitCast:
902 case Instruction::GetElementPtr:
903 case Instruction::AddrSpaceCast:
912 case Instruction::PHI: {
913 PHINode *PN = cast<PHINode>(RVI);
919 case Instruction::Invoke: {
924 if (Callee && SCCNodes.count(Callee)) {
943 bool SCCReturnsNonNull =
true;
945 bool MadeChange =
false;
966 bool Speculative =
false;
980 SCCReturnsNonNull =
false;
983 if (SCCReturnsNonNull) {
986 Attribute::NonNull) ||
1007 bool HasConvergentFn =
false;
1010 HasConvergentFn =
true;
1027 if (!HasConvergentFn)
return false;
1055 if (SCCNodes.size() != 1)
1067 Function *Callee = CS.getCalledFunction();
1095 SCCNodeSet SCCNodes;
1096 bool HasUnknownCall =
false;
1102 HasUnknownCall =
true;
1109 if (!HasUnknownCall)
1112 if (!CS.getCalledFunction()) {
1113 HasUnknownCall =
true;
1117 SCCNodes.insert(&F);
1120 bool Changed =
false;
1127 if (!HasUnknownCall) {
1158 "Deduce function attributes",
false,
false)
1165 return new PostOrderFunctionAttrsLegacyPass();
1168 template <
typename AARGetterT>
1170 bool Changed =
false;
1176 SCCNodeSet SCCNodes;
1177 bool ExternalNode =
false;
1183 ExternalNode =
true;
1191 if (SCCNodes.empty())
1200 if (!ExternalNode) {
1210 bool PostOrderFunctionAttrsLegacyPass::runOnSCC(
CallGraphSCC &SCC) {
1217 struct ReversePostOrderFunctionAttrsLegacyPass :
public ModulePass {
1219 ReversePostOrderFunctionAttrsLegacyPass() :
ModulePass(
ID) {
1224 bool runOnModule(
Module &M)
override;
1236 "Deduce function attributes in RPO",
false,
false)
1242 return new ReversePostOrderFunctionAttrsLegacyPass();
1251 "This function has already been deduced as norecurs!");
1253 "Can only do top-down deduction for internal linkage functions!");
1263 for (
auto *U : F.
users()) {
1287 Function *F =
I->front()->getFunction();
1293 bool Changed =
false;
1294 for (
auto *F :
reverse(Worklist))
1300 bool ReversePostOrderFunctionAttrsLegacyPass::runOnModule(
Module &M) {
1304 auto &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
bool hasNoCaptureAttr() const
Return true if this argument has the nocapture attribute.
Pass interface - Implemented by all 'passes'.
static ChildIteratorType nodes_end(ArgumentGraph *AG)
Return a value (possibly void), from a function.
User::op_iterator arg_iterator
The type of iterator to use when looping over actual arguments at this call site. ...
MemoryAccessKind
The three kinds of memory access relevant to 'readonly' and 'readnone' attributes.
void push_back(const T &Elt)
This builds on the llvm/ADT/GraphTraits.h file to find the strongly connected components (SCCs) of a ...
const_iterator end(StringRef path)
Get end iterator over path.
iterator_range< use_iterator > uses()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents an incoming formal argument to a Function.
bool isConvergent() const
Determine if the call is convergent.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This callback is used in conjunction with PointerMayBeCaptured.
STATISTIC(NumFunctions,"Total number of functions")
bool doesNotCapture(unsigned OpNo) const
Determine whether this data operand is not captured.
bool onlyReadsMemory() const
Determine if the function does not access or only reads memory.
void removeAttr(Attribute::AttrKind Kind)
Remove attributes from an argument.
static bool isFunctionMallocLike(Function *F, const SCCNodeSet &SCCNodes)
Tests whether a function is "malloc-like".
A Module instance is used to store all the information related to an LLVM module. ...
static bool addArgumentReturnedAttrs(const SCCNodeSet &SCCNodes)
Deduce returned attributes for the SCC.
static bool setDoesNotRecurse(Function &F)
BBTy * getParent() const
Get the basic block containing the call site.
bool isConvergent() const
Determine if the call is convergent.
An immutable pass that tracks lazily created AssumptionCache objects.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
bool hasExactDefinition() const
Return true if this global has an exact defintion.
bool onlyReadsMemory(ImmutableCallSite CS)
Checks if the specified call is known to only read from non-volatile memory (or not access memory at ...
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
const Function * getParent() const
Return the enclosing method, or null if none.
The two locations do not alias at all.
An instruction for reading from memory.
SmallVectorImpl< ArgumentGraphNode * >::iterator ChildIteratorType
MemoryAccessKind computeFunctionBodyMemoryAccess(Function &F, AAResults &AAR)
Returns the memory access properties of this copy of the function.
A proxy from a FunctionAnalysisManager to an SCC.
A node in the call graph for a module.
void getAnalysisUsage(AnalysisUsage &Info) const override
getAnalysisUsage - For this class, we declare that we require and preserve the call graph...
size_type size() const
Determine the number of elements in the SetVector.
The access modifies the value stored in memory.
Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager...
void initializeReversePostOrderFunctionAttrsLegacyPassPass(PassRegistry &)
StringRef getName() const
Return a constant reference to the value's name.
AttributeList getAttributes() const
Return the attribute list for this Function.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
static bool addNonNullAttrs(const SCCNodeSet &SCCNodes)
Deduce nonnull attributes for the SCC.
static MemoryAccessKind checkFunctionMemoryAccess(Function &F, bool ThisBody, AAResults &AAR, const SCCNodeSet &SCCNodes)
Returns the memory access attribute for function F using AAR for AA results, where SCCNodes is the cu...
inst_iterator inst_begin(Function *F)
bool doesNotThrow() const
Determine if the function cannot unwind.
This class represents the LLVM 'select' instruction.
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
A Use represents the edge between a Value definition and its users.
bool hasInternalLinkage() const
static ChildIteratorType child_end(NodeRef N)
static bool runImpl(CallGraphSCC &SCC, AARGetterT AARGetter)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
bool hasRetAttr(Attribute::AttrKind Kind) const
Return true if this return value has the given attribute.
This class is a functor to be used in legacy module or SCC passes for computing AA results for a func...
No attributes have been set.
friend const_iterator begin(StringRef path, Style style)
Get begin iterator over path.
The access references the value stored in memory.
LLVM_NODISCARD bool empty() const
scc_iterator< T > scc_begin(const T &G)
Construct the begin iterator for a deduced graph type T.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
bool insert(const value_type &X)
Insert a new element into the SetVector.
bool mayReadFromMemory() const
Return true if this instruction may read memory.
FunctionModRefBehavior
Summary of how a function affects memory in the program.
A lazily constructed view of the call graph of a module.
An instruction for storing to memory.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
unsigned getNumIncomingValues() const
Return the number of incoming edges.
bool hasOperandBundles() const
static bool addReadAttrs(const SCCNodeSet &SCCNodes, AARGetterT &&AARGetter)
Deduce readonly/readnone attributes for the SCC.
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
Checks whether the given location points to constant memory, or if OrLocal is true whether it points ...
static MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
Type * getReturnType() const
Returns the type of the ret val.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
bool isGuaranteedToTransferExecutionToSuccessor(const Instruction *I)
Return true if this function can prove that the instruction I will always transfer execution to one o...
friend const_iterator end(StringRef path)
Get end iterator over path.
void addAttr(Attribute::AttrKind Kind)
A set of analyses that are preserved following a run of a transformation pass.
The ModulePass which wraps up a CallGraph and the logic to build it.
LLVM Basic Block Representation.
This is an important base class in LLVM.
bool hasInAllocaAttr() const
Return true if this argument has the inalloca attribute.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
A manager for alias analyses.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS)
Return the behavior of the given call site.
Represent the analysis usage information of a pass.
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
static bool addNoRecurseAttrs(const SCCNodeSet &SCCNodes)
bool any_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
static bool addNoRecurseAttrsTopDown(Function &F)
bool doesNotRecurse() const
Determine if the function is known not to recurse, directly or indirectly.
Value * getOperand(unsigned i) const
A node in the call graph.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
static cl::opt< bool > EnableNonnullArgPropagation("enable-nonnull-arg-prop", cl::Hidden, cl::desc("Try to propagate nonnull argument attributes from callsites to ""caller functions."))
Pass * createReversePostOrderFunctionAttrsPass()
createReversePostOrderFunctionAttrsPass - This pass walks SCCs of the call graph in RPO to deduce and...
bool isPointerTy() const
True if this is an instance of PointerType.
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
Pass * createPostOrderFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to compute function attrs in post-order.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
bool PointerMayBeCaptured(const Value *V, bool ReturnCaptures, bool StoreCaptures)
PointerMayBeCaptured - Return true if this pointer value may be captured by the enclosing function (w...
bool returnDoesNotAlias() const
Determine if the parameter or return value is marked with NoAlias attribute.
const Value * getTrueValue() const
void getAAResultsAnalysisUsage(AnalysisUsage &AU)
A helper for the legacy pass manager to populate AU to add uses to make sure the analyses required by...
This function does not perform any non-local loads or stores to memory.
bool mayWriteToMemory() const
Return true if this instruction may modify memory.
bool doesNotAccessMemory() const
Determine if the call does not access memory.
Representation for a specific memory location.
ArgumentGraphNode * NodeRef
A SetVector that performs no allocations if smaller than a certain size.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
Value * getIncomingValue(unsigned i) const
Return incoming value number x.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static NodeRef getEntryNode(ArgumentGraph *AG)
Type * getType() const
All values are typed, get the type of this value.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
LLVM_NODISCARD T pop_back_val()
void setPreservesCFG()
This function should be called by the pass, iff they do not:
const BasicBlock & getEntryBlock() const
unsigned data_operands_size() const
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
unsigned getNumArgOperands() const
static ChildIteratorType child_begin(NodeRef N)
typename SuperClass::iterator iterator
iterator_range< user_iterator > users()
static bool addNoAliasAttrs(const SCCNodeSet &SCCNodes)
Deduce noalias attributes for the SCC.
static bool addArgumentAttrs(const SCCNodeSet &SCCNodes)
Deduce nocapture attributes for the SCC.
static bool removeConvergentAttrs(const SCCNodeSet &SCCNodes)
Remove the convergent attribute from all functions in the SCC if every callsite within the SCC is not...
llvm_unreachable("Unknown RegBank!")
An analysis pass to compute the CallGraph for a Module.
static bool onlyAccessesArgPointees(FunctionModRefBehavior MRB)
Checks if functions with the specified behavior are known to read and write at most from objects poin...
The basic data container for the call graph of a Module of IR.
bool isKnownNonNull(const Value *V)
Return true if this pointer couldn't possibly be null by its definition.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
static bool addArgumentAttrsFromCallsites(Function &F)
If a callsite has arguments that are also arguments to the parent function, try to propagate attribut...
void initializePostOrderFunctionAttrsLegacyPassPass(PassRegistry &)
void getAAMetadata(AAMDNodes &N, bool Merge=false) const
Fills the AAMDNodes structure with AA metadata from this instruction.
The access both references and modifies the value stored in memory.
static NodeRef getEntryNode(NodeRef A)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Deduce function attributes
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
void preserve()
Mark an analysis as preserved.
Provides passes for computing function attributes based on interprocedural analyses.
static bool isReturnNonNull(Function *F, const SCCNodeSet &SCCNodes, bool &Speculative)
Tests whether this function is known to not return null.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
INITIALIZE_PASS_BEGIN(PostOrderFunctionAttrsLegacyPass,"functionattrs","Deduce function attributes", false, false) INITIALIZE_PASS_END(PostOrderFunctionAttrsLegacyPass
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
LLVM Value Representation.
An SCC of the call graph.
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
rpo Deduce function attributes in RPO
static ChildIteratorType nodes_begin(ArgumentGraph *AG)
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
print Print MemDeps of function
const Value * getFalseValue() const
This is the interface for LLVM's primary stateless and local alias analysis.
inst_range instructions(Function *F)
inst_iterator inst_end(Function *F)
A container for analyses that lazily runs them and caches their results.
static bool isVolatile(Instruction *Inst)
op_range incoming_values()
static Attribute::AttrKind determinePointerReadAttrs(Argument *A, const SmallPtrSet< Argument *, 8 > &SCCNodes)
Returns Attribute::None, Attribute::ReadOnly or Attribute::ReadNone.
static bool deduceFunctionAttributeInRPO(Module &M, CallGraph &CG)
iterator_range< arg_iterator > args()
Enumerate the SCCs of a directed graph in reverse topological order of the SCC DAG.
bool isVoidTy() const
Return true if this is 'void'.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
void setReturnDoesNotAlias()