31 #define DEBUG_TYPE "objc-arc-dependency" 48 const auto *Call = cast<CallBase>(Inst);
56 for (
const Value *
Op : Call->args()) {
93 if (
const ICmpInst *ICI = dyn_cast<ICmpInst>(Inst)) {
102 OE = CS.arg_end(); OI != OE; ++OI) {
109 }
else if (
const StoreInst *
SI = dyn_cast<StoreInst>(Inst)) {
147 return CanUse(Inst, Arg, PA, Class);
229 Worklist.
push_back(std::make_pair(StartBB, StartPos));
231 std::pair<BasicBlock *, BasicBlock::iterator> Pair =
237 if (LocalStartPos == StartBBBegin) {
241 DependingInsts.
insert(
nullptr);
246 if (Visited.
insert(PredBB).second)
247 Worklist.
push_back(std::make_pair(PredBB, PredBB->
end()));
248 }
while (++PI != PE);
253 if (
Depends(Flavor, Inst, Arg, PA)) {
254 DependingInsts.
insert(Inst);
258 }
while (!Worklist.
empty());
267 if (Succ != StartBB && !Visited.count(Succ)) {
268 DependingInsts.
insert(reinterpret_cast<Instruction *>(-1));
A parsed version of the target data layout string in and methods for querying it. ...
This file declares special dependency analysis routines used in Objective C ARC Optimizations.
ARCInstKind GetARCInstKind(const Value *V)
Map V to its ARCInstKind equivalence class.
This class represents lattice values for constants.
bool CanUse(const Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class)
Test whether the given instruction can "use" the given pointer's object in a way that requires the re...
Blocks objc_retainAutorelease.
void push_back(const T &Elt)
Value * GetArgRCIdentityRoot(Value *Inst)
Assuming the given instruction is one of the special calls such as objc_retain or objc_release...
iterator begin()
Instruction iterator methods.
objc_autoreleaseReturnValue
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
bool Depends(DependenceKind Flavor, Instruction *Inst, const Value *Arg, ProvenanceAnalysis &PA)
Test if there can be dependencies on Inst through Arg.
A Use represents the edge between a Value definition and its users.
FunctionModRefBehavior getModRefBehavior(const CallBase *Call)
Return the behavior of the given call site.
objc_retainAutoreleasedReturnValue
bool IsPotentialRetainableObjPtr(const Value *Op)
Test whether the given value is possible a retainable object pointer.
FunctionModRefBehavior
Summary of how a function affects memory in the program.
An instruction for storing to memory.
LLVM Basic Block Representation.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
This instruction compares its operands according to the predicate given to the constructor.
self_iterator getIterator()
bool onlyReadsMemory(const CallBase *Call)
Checks if the specified call is known to only read from non-volatile memory (or not access memory at ...
anything that is inert from an ARC perspective.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
ARCInstKind GetBasicARCInstKind(const Value *V)
Determine which objc runtime call instruction class V belongs to.
bool CanDecrementRefCount(ARCInstKind Kind)
Returns false if conservatively we can prove that any instruction mapped to this kind can not decreme...
DependenceKind
Defines different dependence kinds among various ARC constructs.
Iterator for intrusive lists based on ilist_node.
AliasAnalysis * getAA() const
This file declares a special form of Alias Analysis called ``Provenance Analysis''.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
ARCInstKind
Equivalence classes of instructions in the ARC Model.
LLVM_NODISCARD T pop_back_val()
bool related(const Value *A, const Value *B, const DataLayout &DL)
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
void FindDependencies(DependenceKind Flavor, const Value *Arg, BasicBlock *StartBB, Instruction *StartInst, SmallPtrSetImpl< Instruction *> &DependingInstructions, SmallPtrSetImpl< const BasicBlock *> &Visited, ProvenanceAnalysis &PA)
Walk up the CFG from StartPos (which is in StartBB) and find local and non-local dependencies on Arg...
amdgpu Simplify well known AMD library false Value Value * Arg
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
static bool onlyAccessesArgPointees(FunctionModRefBehavior MRB)
Checks if functions with the specified behavior are known to read and write at most from objects poin...
LLVM_NODISCARD bool empty() const
Establish a view to a call site for examination.
Blocks objc_retainAutoreleaseReturnValue.
bool CanAlterRefCount(const Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class)
Test whether the given instruction can result in a reference count modification (positive or negative...
const Value * GetUnderlyingObjCPtr(const Value *V, const DataLayout &DL)
This is a wrapper around getUnderlyingObject which also knows how to look through objc_retain and obj...
LLVM Value Representation.
succ_range successors(Instruction *I)
This is similar to BasicAliasAnalysis, and it uses many of the same techniques, except it uses specia...
bool CanInterruptRV(ARCInstKind Class)
Test whether the given instruction can autorelease any pointer or cause an autoreleasepool pop...
Blocks objc_retainAutoreleasedReturnValue.