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,
59 if (PNB->getParent() ==
A->getParent()) {
60 for (
unsigned i = 0, e =
A->getNumIncomingValues(); i != e; ++i)
62 PNB->getIncomingValueForBlock(
A->getIncomingBlock(i))))
68 SmallPtrSet<const Value *, 4> UniqueSrc;
69 for (
Value *PV1 :
A->incoming_values()) {
90 for (
const Use &U :
P->uses()) {
91 const User *Ur = U.getUser();
93 if (U.getOperandNo() == 0)
105 if (Visited.
insert(Ur).second)
108 }
while (!Worklist.
empty());
114bool ProvenanceAnalysis::relatedCheck(
const Value *
A,
const Value *
B) {
116 switch (AA->alias(
A,
B)) {
141 }
else if (BIsIdentified) {
149 return relatedPHI(PN,
B);
151 return relatedPHI(PN,
A);
153 return relatedSelect(S,
B);
155 return relatedSelect(S,
A);
172 std::pair<CachedResultsTy::iterator, bool> Pair =
173 CachedResults.insert(std::make_pair(ValuePairTy(
A,
B),
true));
175 return Pair.first->second;
177 bool Result = relatedCheck(
A,
B);
178 CachedResults[ValuePairTy(
A,
B)] = Result;
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
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.
bool related(const Value *A, const Value *B)
@ 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.
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 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.
FunctionAddr VTableAddr Value
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...