projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
A8.6.315 VLD3 (single 3-element structure to all lanes)
[oota-llvm.git]
/
lib
/
Analysis
/
MemoryDependenceAnalysis.cpp
diff --git
a/lib/Analysis/MemoryDependenceAnalysis.cpp
b/lib/Analysis/MemoryDependenceAnalysis.cpp
index f29ff4a73141768c262ea62ee4602ed5c94ecb00..35043bddfaf6c541904d329f61fc31e36d680eb9 100644
(file)
--- a/
lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/
lib/Analysis/MemoryDependenceAnalysis.cpp
@@
-25,10
+25,12
@@
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/PHITransAddr.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/PHITransAddr.h"
+#include "llvm/Analysis/ValueTracking.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/PredIteratorCache.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/PredIteratorCache.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Target/TargetData.h"
using namespace llvm;
STATISTIC(NumCacheNonLocal, "Number of fully cached non-local responses");
using namespace llvm;
STATISTIC(NumCacheNonLocal, "Number of fully cached non-local responses");
@@
-82,6
+84,7
@@
void MemoryDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
bool MemoryDependenceAnalysis::runOnFunction(Function &) {
AA = &getAnalysis<AliasAnalysis>();
bool MemoryDependenceAnalysis::runOnFunction(Function &) {
AA = &getAnalysis<AliasAnalysis>();
+ TD = getAnalysisIfAvailable<TargetData>();
if (PredCache == 0)
PredCache.reset(new PredIteratorCache());
return false;
if (PredCache == 0)
PredCache.reset(new PredIteratorCache());
return false;
@@
-97,7
+100,7
@@
static void RemoveFromReverseMap(DenseMap<Instruction*,
InstIt = ReverseMap.find(Inst);
assert(InstIt != ReverseMap.end() && "Reverse map out of sync?");
bool Found = InstIt->second.erase(Val);
InstIt = ReverseMap.find(Inst);
assert(InstIt != ReverseMap.end() && "Reverse map out of sync?");
bool Found = InstIt->second.erase(Val);
- assert(Found && "Invalid reverse map!");
Found=
Found;
+ assert(Found && "Invalid reverse map!");
(void)
Found;
if (InstIt->second.empty())
ReverseMap.erase(InstIt);
}
if (InstIt->second.empty())
ReverseMap.erase(InstIt);
}
@@
-115,9
+118,7
@@
AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst,
Loc = AliasAnalysis::Location();
return AliasAnalysis::ModRef;
}
Loc = AliasAnalysis::Location();
return AliasAnalysis::ModRef;
}
- Loc = AliasAnalysis::Location(LI->getPointerOperand(),
- AA->getTypeStoreSize(LI->getType()),
- LI->getMetadata(LLVMContext::MD_tbaa));
+ Loc = AA->getLocation(LI);
return AliasAnalysis::Ref;
}
return AliasAnalysis::Ref;
}
@@
-126,17
+127,12
@@
AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst,
Loc = AliasAnalysis::Location();
return AliasAnalysis::ModRef;
}
Loc = AliasAnalysis::Location();
return AliasAnalysis::ModRef;
}
- Loc = AliasAnalysis::Location(SI->getPointerOperand(),
- AA->getTypeStoreSize(SI->getValueOperand()
- ->getType()),
- SI->getMetadata(LLVMContext::MD_tbaa));
+ Loc = AA->getLocation(SI);
return AliasAnalysis::Mod;
}
if (const VAArgInst *V = dyn_cast<VAArgInst>(Inst)) {
return AliasAnalysis::Mod;
}
if (const VAArgInst *V = dyn_cast<VAArgInst>(Inst)) {
- Loc = AliasAnalysis::Location(V->getPointerOperand(),
- AA->getTypeStoreSize(V->getType()),
- V->getMetadata(LLVMContext::MD_tbaa));
+ Loc = AA->getLocation(V);
return AliasAnalysis::ModRef;
}
return AliasAnalysis::ModRef;
}
@@
-288,10
+284,7
@@
getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
// Values depend on loads if the pointers are must aliased. This means that
// a load depends on another must aliased load from the same value.
if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) {
// Values depend on loads if the pointers are must aliased. This means that
// a load depends on another must aliased load from the same value.
if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) {
- Value *Pointer = LI->getPointerOperand();
- uint64_t PointerSize = AA->getTypeStoreSize(LI->getType());
- MDNode *TBAATag = LI->getMetadata(LLVMContext::MD_tbaa);
- AliasAnalysis::Location LoadLoc(Pointer, PointerSize, TBAATag);
+ AliasAnalysis::Location LoadLoc = AA->getLocation(LI);
// If we found a pointer, check if it could be the same as our pointer.
AliasAnalysis::AliasResult R = AA->alias(LoadLoc, MemLoc);
// If we found a pointer, check if it could be the same as our pointer.
AliasAnalysis::AliasResult R = AA->alias(LoadLoc, MemLoc);
@@
-299,7
+292,7
@@
getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
continue;
// May-alias loads don't depend on each other without a dependence.
continue;
// May-alias loads don't depend on each other without a dependence.
- if (isLoad && R
== AliasAnalysis::May
Alias)
+ if (isLoad && R
!= AliasAnalysis::Must
Alias)
continue;
// Stores don't alias loads from read-only memory.
continue;
// Stores don't alias loads from read-only memory.
@@
-324,20
+317,16
@@
getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
// Ok, this store might clobber the query pointer. Check to see if it is
// a must alias: in this case, we want to return this as a def.
// Ok, this store might clobber the query pointer. Check to see if it is
// a must alias: in this case, we want to return this as a def.
- Value *Pointer = SI->getPointerOperand();
- uint64_t PointerSize = AA->getTypeStoreSize(SI->getOperand(0)->getType());
- MDNode *TBAATag = SI->getMetadata(LLVMContext::MD_tbaa);
+ AliasAnalysis::Location StoreLoc = AA->getLocation(SI);
// If we found a pointer, check if it could be the same as our pointer.
// If we found a pointer, check if it could be the same as our pointer.
- AliasAnalysis::AliasResult R =
- AA->alias(AliasAnalysis::Location(Pointer, PointerSize, TBAATag),
- MemLoc);
+ AliasAnalysis::AliasResult R = AA->alias(StoreLoc, MemLoc);
if (R == AliasAnalysis::NoAlias)
continue;
if (R == AliasAnalysis::NoAlias)
continue;
- if (R == AliasAnalysis::M
ay
Alias)
- return MemDepResult::get
Clobber
(Inst);
- return MemDepResult::get
Def
(Inst);
+ if (R == AliasAnalysis::M
ust
Alias)
+ return MemDepResult::get
Def
(Inst);
+ return MemDepResult::get
Clobber
(Inst);
}
// If this is an allocation, and if we know that the accessed pointer is to
}
// If this is an allocation, and if we know that the accessed pointer is to
@@
-350,7
+339,7
@@
getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
// need to continue scanning until the malloc call.
if (isa<AllocaInst>(Inst) ||
(isa<CallInst>(Inst) && extractMallocCall(Inst))) {
// need to continue scanning until the malloc call.
if (isa<AllocaInst>(Inst) ||
(isa<CallInst>(Inst) && extractMallocCall(Inst))) {
- const Value *AccessPtr =
MemLoc.Ptr->getUnderlyingObject(
);
+ const Value *AccessPtr =
GetUnderlyingObject(MemLoc.Ptr, TD
);
if (AccessPtr == Inst ||
AA->alias(Inst, 1, AccessPtr, 1) == AliasAnalysis::MustAlias)
if (AccessPtr == Inst ||
AA->alias(Inst, 1, AccessPtr, 1) == AliasAnalysis::MustAlias)
@@
-423,9
+412,9
@@
MemDepResult MemoryDependenceAnalysis::getDependency(Instruction *QueryInst) {
if (MemLoc.Ptr) {
// If we can do a pointer scan, make it happen.
bool isLoad = !(MR & AliasAnalysis::Mod);
if (MemLoc.Ptr) {
// If we can do a pointer scan, make it happen.
bool isLoad = !(MR & AliasAnalysis::Mod);
- if (IntrinsicInst *II = dyn_cast<
MemoryUseIntrinsic>(QueryInst)) {
+ if (IntrinsicInst *II = dyn_cast<
IntrinsicInst>(QueryInst))
isLoad |= II->getIntrinsicID() == Intrinsic::lifetime_end;
isLoad |= II->getIntrinsicID() == Intrinsic::lifetime_end;
- }
+
LocalCache = getPointerDependencyFrom(MemLoc, isLoad, ScanPos,
QueryParent);
} else if (isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)) {
LocalCache = getPointerDependencyFrom(MemLoc, isLoad, ScanPos,
QueryParent);
} else if (isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)) {
@@
-858,11
+847,8
@@
getNonLocalPointerDepFromBB(const PHITransAddr &Pointer,
// otherwise it isn't.
if (Cache->empty())
CacheInfo->Pair = BBSkipFirstBlockPair(StartBB, SkipFirstBlock);
// otherwise it isn't.
if (Cache->empty())
CacheInfo->Pair = BBSkipFirstBlockPair(StartBB, SkipFirstBlock);
- else
{
+ else
CacheInfo->Pair = BBSkipFirstBlockPair();
CacheInfo->Pair = BBSkipFirstBlockPair();
- CacheInfo->Size = AliasAnalysis::UnknownSize;
- CacheInfo->TBAATag = 0;
- }
SmallVector<BasicBlock*, 32> Worklist;
Worklist.push_back(StartBB);
SmallVector<BasicBlock*, 32> Worklist;
Worklist.push_back(StartBB);
@@
-986,8
+972,6
@@
getNonLocalPointerDepFromBB(const PHITransAddr &Pointer,
// cached value to do more work but not miss the phi trans failure.
NonLocalPointerInfo &NLPI = NonLocalPointerDeps[CacheKey];
NLPI.Pair = BBSkipFirstBlockPair();
// cached value to do more work but not miss the phi trans failure.
NonLocalPointerInfo &NLPI = NonLocalPointerDeps[CacheKey];
NLPI.Pair = BBSkipFirstBlockPair();
- NLPI.Size = AliasAnalysis::UnknownSize;
- NLPI.TBAATag = 0;
continue;
}
continue;
}
@@
-1015,8
+999,6
@@
getNonLocalPointerDepFromBB(const PHITransAddr &Pointer,
// specific block queries) but we can't do the fastpath "return all
// results from the set" Clear out the indicator for this.
CacheInfo->Pair = BBSkipFirstBlockPair();
// specific block queries) but we can't do the fastpath "return all
// results from the set" Clear out the indicator for this.
CacheInfo->Pair = BBSkipFirstBlockPair();
- CacheInfo->Size = AliasAnalysis::UnknownSize;
- CacheInfo->TBAATag = 0;
SkipFirstBlock = false;
continue;
SkipFirstBlock = false;
continue;
@@
-1034,8
+1016,6
@@
getNonLocalPointerDepFromBB(const PHITransAddr &Pointer,
// specific block queries) but we can't do the fastpath "return all
// results from the set". Clear out the indicator for this.
CacheInfo->Pair = BBSkipFirstBlockPair();
// specific block queries) but we can't do the fastpath "return all
// results from the set". Clear out the indicator for this.
CacheInfo->Pair = BBSkipFirstBlockPair();
- CacheInfo->Size = AliasAnalysis::UnknownSize;
- CacheInfo->TBAATag = 0;
// If *nothing* works, mark the pointer as being clobbered by the first
// instruction in this block.
// If *nothing* works, mark the pointer as being clobbered by the first
// instruction in this block.
@@
-1252,8
+1232,6
@@
void MemoryDependenceAnalysis::removeInstruction(Instruction *RemInst) {
// The cache is not valid for any specific block anymore.
NonLocalPointerDeps[P].Pair = BBSkipFirstBlockPair();
// The cache is not valid for any specific block anymore.
NonLocalPointerDeps[P].Pair = BBSkipFirstBlockPair();
- NonLocalPointerDeps[P].Size = AliasAnalysis::UnknownSize;
- NonLocalPointerDeps[P].TBAATag = 0;
// Update any entries for RemInst to use the instruction after it.
for (NonLocalDepInfo::iterator DI = NLPDI.begin(), DE = NLPDI.end();
// Update any entries for RemInst to use the instruction after it.
for (NonLocalDepInfo::iterator DI = NLPDI.begin(), DE = NLPDI.end();