31 using namespace llvm::objcarc;
33 bool ProvenanceAnalysis::relatedSelect(
const SelectInst *
A,
37 if (
const SelectInst *SB = dyn_cast<SelectInst>(B))
47 bool ProvenanceAnalysis::relatedPHI(
const PHINode *A,
52 if (
const PHINode *PNB = dyn_cast<PHINode>(B))
85 if (isa<StoreInst>(Ur)) {
86 if (UI.getOperandNo() == 0)
92 if (isa<CallInst>(Ur))
95 if (isa<PtrToIntInst>(P))
101 }
while (!Worklist.
empty());
107 bool ProvenanceAnalysis::relatedCheck(
const Value *A,
118 switch (AA->
alias(A, B)) {
134 if (isa<LoadInst>(B))
138 if (isa<LoadInst>(A))
143 }
else if (BIsIdentified) {
145 if (isa<LoadInst>(A))
150 if (
const PHINode *PN = dyn_cast<PHINode>(A))
151 return relatedPHI(PN, B);
152 if (
const PHINode *PN = dyn_cast<PHINode>(B))
153 return relatedPHI(PN, A);
154 if (
const SelectInst *S = dyn_cast<SelectInst>(A))
155 return relatedSelect(S, B);
156 if (
const SelectInst *S = dyn_cast<SelectInst>(B))
157 return relatedSelect(S, A);
169 std::pair<CachedResultsTy::iterator, bool> Pair =
170 CachedResults.
insert(std::make_pair(ValuePairTy(A, B),
true));
172 return Pair.first->second;
174 bool Result = relatedCheck(A, B);
175 CachedResults[ValuePairTy(A, B)] = Result;
void push_back(const T &Elt)
Pointers differ, but pointees overlap.
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val()
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
bool related(const Value *A, const Value *B)
unsigned getNumIncomingValues() const
static bool IsStoredObjCPointer(const Value *P)
virtual AliasResult alias(const Location &LocA, const Location &LocB)
const Value * getCondition() const
BasicBlock * getIncomingBlock(unsigned i) const
static bool IsObjCIdentifiedObject(const Value *V)
Return true if this value refers to a distinct and identifiable object.
const Value * getTrueValue() const
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Value * getIncomingValue(unsigned i) const
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
LLVM Value Representation.
const Value * getFalseValue() const
static const Value * GetUnderlyingObjCPtr(const Value *V)
This is a wrapper around getUnderlyingObject which also knows how to look through objc_retain and obj...
const BasicBlock * getParent() const