41bool ProvenanceAnalysis::relatedSelect(
const SelectInst *
A,
46 if (
A->getCondition() == SB->getCondition())
47 return related(
A->getTrueValue(), SB->getTrueValue()) ||
48 related(
A->getFalseValue(), SB->getFalseValue());
54bool ProvenanceAnalysis::relatedPHI(
const PHINode *
A,
59 if (
const PHINode *PNB = dyn_cast<PHINode>(
B))
60 if (PNB->getParent() ==
A->getParent()) {
61 for (
unsigned i = 0, e =
A->getNumIncomingValues(); i != e; ++i)
63 PNB->getIncomingValueForBlock(
A->getIncomingBlock(i))))
70 for (
Value *PV1 :
A->incoming_values()) {
88 for (
const Use &U :
P->uses()) {
89 const User *Ur = U.getUser();
90 if (isa<StoreInst>(Ur)) {
91 if (U.getOperandNo() == 0)
97 if (isa<CallInst>(Ur))
100 if (isa<PtrToIntInst>(
P))
103 if (Visited.
insert(Ur).second)
106 }
while (!Worklist.
empty());
112bool ProvenanceAnalysis::relatedCheck(
const Value *
A,
const Value *
B) {
130 if (isa<LoadInst>(
B))
134 if (isa<LoadInst>(
A))
139 }
else if (BIsIdentified) {
141 if (isa<LoadInst>(
A))
146 if (
const PHINode *PN = dyn_cast<PHINode>(
A))
147 return relatedPHI(PN,
B);
148 if (
const PHINode *PN = dyn_cast<PHINode>(
B))
149 return relatedPHI(PN,
A);
151 return relatedSelect(S,
B);
153 return relatedSelect(S,
A);
170 std::pair<CachedResultsTy::iterator, bool> Pair =
171 CachedResults.
insert(std::make_pair(ValuePairTy(
A,
B),
true));
173 return Pair.first->second;
175 bool Result = relatedCheck(
A,
B);
176 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")
Module.h This file contains the declarations for the Module 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.
This defines the Use 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.