Go to the documentation of this file.
31 #define DEBUG_TYPE "objc-arc-dependency"
48 const auto *Call = cast<CallBase>(Inst);
55 for (
const Value *
Op : Call->args()) {
89 if (
const ICmpInst *ICI = dyn_cast<ICmpInst>(Inst)) {
95 }
else if (
const auto *CS = dyn_cast<CallBase>(Inst)) {
97 for (
const Value *
Op : CS->args())
101 }
else if (
const StoreInst *
SI = dyn_cast<StoreInst>(Inst)) {
214 Worklist.push_back(std::make_pair(StartBB, StartPos));
216 std::pair<BasicBlock *, BasicBlock::iterator> Pair =
222 if (LocalStartPos == StartBBBegin) {
230 if (Visited.
insert(PredBB).second)
231 Worklist.push_back(std::make_pair(PredBB, PredBB->
end()));
232 }
while (++PI != PE);
238 DependingInsts.
insert(Inst);
242 }
while (!Worklist.empty());
251 if (Succ != StartBB && !Visited.count(Succ))
266 DependingInsts.
size() != 1)
268 return *DependingInsts.
begin();
ARCInstKind GetBasicARCInstKind(const Value *V)
Determine which objc runtime call instruction class V belongs to.
@ User
could "use" a pointer
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...
This is an optimization pass for GlobalISel generic memory operations.
InstListType::iterator iterator
Instruction iterators...
@ NeedsPositiveRetainCount
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
@ RetainAutoreleaseDep
Blocks objc_retainAutorelease.
static bool onlyAccessesArgPointees(FunctionModRefBehavior MRB)
Checks if functions with the specified behavior are known to read and write at most from objects poin...
@ Call
could call objc_release
auto successors(MachineBasicBlock *BB)
This is similar to BasicAliasAnalysis, and it uses many of the same techniques, except it uses specia...
LLVM_NODISCARD T pop_back_val()
ARCInstKind GetARCInstKind(const Value *V)
Map V to its ARCInstKind equivalence class.
@ Autorelease
objc_autorelease
LLVM Basic Block Representation.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
bool CanInterruptRV(ARCInstKind Class)
Test whether the given instruction can autorelease any pointer or cause an autoreleasepool pop.
bool onlyReadsMemory(const CallBase *Call)
Checks if the specified call is known to only read from non-volatile memory (or not access memory at ...
bool IsPotentialRetainableObjPtr(const Value *Op)
Test whether the given value is possible a retainable object pointer.
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.
@ RetainRV
objc_retainAutoreleasedReturnValue
@ IntrinsicUser
llvm.objc.clang.arc.use
static bool findDependencies(DependenceKind Flavor, const Value *Arg, BasicBlock *StartBB, Instruction *StartInst, SmallPtrSetImpl< Instruction * > &DependingInsts, ProvenanceAnalysis &PA)
Walk up the CFG from StartPos (which is in StartBB) and find local and non-local dependencies on Arg.
@ AutoreleasepoolPop
objc_autoreleasePoolPop
An instruction for storing to memory.
This instruction compares its operands according to the predicate given to the constructor.
bool Depends(DependenceKind Flavor, Instruction *Inst, const Value *Arg, ProvenanceAnalysis &PA)
Test if there can be dependencies on Inst through Arg.
StandardInstrumentations SI(Debug, VerifyEach)
@ RetainAutoreleaseRVDep
Blocks objc_retainAutoreleaseReturnValue.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const Value * GetUnderlyingObjCPtr(const Value *V)
This is a wrapper around getUnderlyingObject which also knows how to look through objc_retain and obj...
self_iterator getIterator()
FunctionModRefBehavior
Summary of how a function affects memory in the program.
FunctionModRefBehavior getModRefBehavior(const CallBase *Call)
Return the behavior of the given call site.
@ AutoreleasepoolPush
objc_autoreleasePoolPush
llvm::Instruction * findSingleDependency(DependenceKind Flavor, const Value *Arg, BasicBlock *StartBB, Instruction *StartInst, ProvenanceAnalysis &PA)
Find dependent instructions.
bool CanDecrementRefCount(ARCInstKind Kind)
Returns false if conservatively we can prove that any instruction mapped to this kind can not decreme...
@ None
anything that is inert from an ARC perspective.
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...
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
bool related(const Value *A, const Value *B)
LLVM Value Representation.
@ AutoreleasePoolBoundary
A Use represents the edge between a Value definition and its users.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
@ AutoreleaseRV
objc_autoreleaseReturnValue
AAResults * getAA() const