Go to the documentation of this file.
41 bool ProvenanceAnalysis::relatedSelect(
const SelectInst *A,
45 if (
const SelectInst *SB = dyn_cast<SelectInst>(
B)) {
46 if (
A->getCondition() == SB->getCondition())
47 return related(
A->getTrueValue(), SB->getTrueValue()) ||
48 related(
A->getFalseValue(), SB->getFalseValue());
52 if (!(
related(SB->getTrueValue(), A) ||
related(SB->getFalseValue(), A)))
60 bool ProvenanceAnalysis::relatedPHI(
const PHINode *A,
63 auto comparePHISources = [
this](
const PHINode *PNA,
const Value *
B) ->
bool {
75 if (
const PHINode *PNB = dyn_cast<PHINode>(
B)) {
79 if (PNB->getParent() ==
A->getParent()) {
80 for (
unsigned i = 0,
e =
A->getNumIncomingValues();
i !=
e; ++
i)
82 PNB->getIncomingValueForBlock(
A->getIncomingBlock(
i))))
87 if (!comparePHISources(PNB, A))
91 return comparePHISources(A,
B);
99 Worklist.push_back(
P);
103 for (
const Use &U :
P->uses()) {
104 const User *Ur = U.getUser();
105 if (isa<StoreInst>(Ur)) {
106 if (U.getOperandNo() == 0)
112 if (isa<CallInst>(Ur))
115 if (isa<PtrToIntInst>(
P))
118 if (Visited.
insert(Ur).second)
119 Worklist.push_back(Ur);
121 }
while (!Worklist.empty());
127 bool ProvenanceAnalysis::relatedCheck(
const Value *A,
const Value *
B) {
129 switch (AA->
alias(A,
B)) {
149 if ((AIsIdentified && isa<LoadInst>(
B)) ||
150 (BIsIdentified && isa<LoadInst>(A)))
154 if (AIsIdentified && BIsIdentified && !isa<LoadInst>(A) && !isa<LoadInst>(
B))
158 if (
const PHINode *PN = dyn_cast<PHINode>(A))
159 return relatedPHI(PN,
B);
160 if (
const PHINode *PN = dyn_cast<PHINode>(
B))
161 return relatedPHI(PN, A);
163 return relatedSelect(
S,
B);
165 return relatedSelect(
S, A);
183 std::pair<CachedResultsTy::iterator, bool> Pair =
184 CachedResults.
insert(std::make_pair(ValuePairTy(A,
B),
true));
186 return Pair.first->second;
188 bool Result = relatedCheck(A,
B);
189 assert(relatedCheck(
B, A) == Result &&
190 "relatedCheck result depending on order of parameters!");
191 CachedResults[ValuePairTy(A,
B)] = Result;
@ MayAlias
The two locations may or may not alias.
@ PartialAlias
The two locations alias, but only due to a partial overlap.
This is an optimization pass for GlobalISel generic memory operations.
op_range incoming_values()
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const Value * GetUnderlyingObjCPtrCached(const Value *V, DenseMap< const Value *, std::pair< WeakVH, WeakTrackingVH >> &Cache)
A wrapper for GetUnderlyingObjCPtr used for results memoization.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
This class represents the LLVM 'select' instruction.
bool IsObjCIdentifiedObject(const Value *V)
Return true if this value refers to a distinct and identifiable object.
@ NoAlias
The two locations do not alias at all.
@ MustAlias
The two locations precisely alias each other.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
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...
bool related(const Value *A, const Value *B)
LLVM Value Representation.
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.