40bool ProvenanceAnalysis::relatedSelect(
const SelectInst *
A,
45 if (
A->getCondition() == SB->getCondition())
46 return related(
A->getTrueValue(), SB->getTrueValue()) ||
47 related(
A->getFalseValue(), SB->getFalseValue());
53bool ProvenanceAnalysis::relatedPHI(
const PHINode *
A,
58 if (
const PHINode *PNB = dyn_cast<PHINode>(
B))
59 if (PNB->getParent() ==
A->getParent()) {
60 for (
unsigned i = 0, e =
A->getNumIncomingValues(); i != e; ++i)
62 PNB->getIncomingValueForBlock(
A->getIncomingBlock(i))))
69 for (
Value *PV1 :
A->incoming_values()) {
87 for (
const Use &U :
P->uses()) {
88 const User *Ur = U.getUser();
89 if (isa<StoreInst>(Ur)) {
90 if (U.getOperandNo() == 0)
96 if (isa<CallInst>(Ur))
99 if (isa<PtrToIntInst>(
P))
102 if (Visited.
insert(Ur).second)
105 }
while (!Worklist.
empty());
111bool ProvenanceAnalysis::relatedCheck(
const Value *
A,
const Value *
B) {
129 if (isa<LoadInst>(
B))
133 if (isa<LoadInst>(
A))
138 }
else if (BIsIdentified) {
140 if (isa<LoadInst>(
A))
145 if (
const PHINode *PN = dyn_cast<PHINode>(
A))
146 return relatedPHI(PN,
B);
147 if (
const PHINode *PN = dyn_cast<PHINode>(
B))
148 return relatedPHI(PN,
A);
150 return relatedSelect(S,
B);
152 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;
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This defines the Use class.
This file defines common analysis utilities used by the ObjC ARC Optimizer.
static bool IsStoredObjCPointer(const Value *P)
Test if the value of P, or any value covered by its provenance, is ever stored within the function (n...
This file declares a special form of Alias Analysis called Provenance Analysis''.
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
@ MayAlias
The two locations may or may not alias.
@ NoAlias
The two locations do not alias at all.
@ PartialAlias
The two locations alias, but only due to a partial overlap.
@ MustAlias
The two locations precisely alias each other.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
This class represents the LLVM 'select' instruction.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
bool related(const Value *A, const Value *B)
bool IsObjCIdentifiedObject(const Value *V)
Return true if this value refers to a distinct and identifiable object.
const Value * GetUnderlyingObjCPtrCached(const Value *V, DenseMap< const Value *, std::pair< WeakVH, WeakTrackingVH > > &Cache)
A wrapper for GetUnderlyingObjCPtr used for results memoization.
This is an optimization pass for GlobalISel generic memory operations.