aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/MemoryDependenceAnalysis.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-22 04:25:02 +0000
committerChris Lattner <sabre@nondot.org>2009-12-22 04:25:02 +0000
commit0ee443d169786017d151034b8bd34225bc144c98 (patch)
tree9cb060f0291918df427edb211dc081fc01f085f6 /include/llvm/Analysis/MemoryDependenceAnalysis.h
parent3ea3c2461932d96d3defa0a9aa93ffaf631bb19d (diff)
downloadexternal_llvm-0ee443d169786017d151034b8bd34225bc144c98.zip
external_llvm-0ee443d169786017d151034b8bd34225bc144c98.tar.gz
external_llvm-0ee443d169786017d151034b8bd34225bc144c98.tar.bz2
The phi translated pointer can be computed when returning a partially cached result
instead of stored. This reduces memdep memory usage, and also eliminates a bunch of weakvh's. This speeds up gvn on gcc.c-torture/20001226-1.c from 23.9s to 8.45s (2.8x) on a different machine than earlier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91885 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/MemoryDependenceAnalysis.h')
-rw-r--r--include/llvm/Analysis/MemoryDependenceAnalysis.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h
index c04631b..f83cc4f 100644
--- a/include/llvm/Analysis/MemoryDependenceAnalysis.h
+++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h
@@ -132,21 +132,17 @@ namespace llvm {
}
};
- /// NonLocalDepEntry - This is an entry in the NonLocalDepInfo cache, and an
- /// entry in the results set for a non-local query. For each BasicBlock (the
- /// BB entry) it keeps a MemDepResult and the (potentially phi translated)
- /// address that was live in the block.
- class NonLocalDepEntry {
+ /// NonLocalDepResult - This is a result from a NonLocal dependence query.
+ /// For each BasicBlock (the BB entry) it keeps a MemDepResult and the
+ /// (potentially phi translated) address that was live in the block.
+ class NonLocalDepResult {
BasicBlock *BB;
MemDepResult Result;
- WeakVH Address;
+ Value *Address;
public:
- NonLocalDepEntry(BasicBlock *bb, MemDepResult result, Value *address)
+ NonLocalDepResult(BasicBlock *bb, MemDepResult result, Value *address)
: BB(bb), Result(result), Address(address) {}
-
- // This is used for searches.
- NonLocalDepEntry(BasicBlock *bb) : BB(bb) {}
-
+
// BB is the sort key, it can't be changed.
BasicBlock *getBB() const { return BB; }
@@ -154,7 +150,7 @@ namespace llvm {
Result = R;
Address = Addr;
}
-
+
const MemDepResult &getResult() const { return Result; }
/// getAddress - Return the address of this pointer in this block. This can
@@ -165,7 +161,27 @@ namespace llvm {
///
/// The address is always null for a non-local 'call' dependence.
Value *getAddress() const { return Address; }
+ };
+
+ /// NonLocalDepEntry - This is an entry in the NonLocalDepInfo cache. For
+ /// each BasicBlock (the BB entry) it keeps a MemDepResult.
+ class NonLocalDepEntry {
+ BasicBlock *BB;
+ MemDepResult Result;
+ public:
+ NonLocalDepEntry(BasicBlock *bb, MemDepResult result)
+ : BB(bb), Result(result) {}
+
+ // This is used for searches.
+ NonLocalDepEntry(BasicBlock *bb) : BB(bb) {}
+ // BB is the sort key, it can't be changed.
+ BasicBlock *getBB() const { return BB; }
+
+ void setResult(const MemDepResult &R) { Result = R; }
+
+ const MemDepResult &getResult() const { return Result; }
+
bool operator<(const NonLocalDepEntry &RHS) const {
return BB < RHS.BB;
}
@@ -283,7 +299,7 @@ namespace llvm {
/// This method assumes the pointer has a "NonLocal" dependency within BB.
void getNonLocalPointerDependency(Value *Pointer, bool isLoad,
BasicBlock *BB,
- SmallVectorImpl<NonLocalDepEntry> &Result);
+ SmallVectorImpl<NonLocalDepResult> &Result);
/// removeInstruction - Remove an instruction from the dependence analysis,
/// updating the dependence of instructions that previously depended on it.
@@ -307,7 +323,7 @@ namespace llvm {
BasicBlock *BB);
bool getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t Size,
bool isLoad, BasicBlock *BB,
- SmallVectorImpl<NonLocalDepEntry> &Result,
+ SmallVectorImpl<NonLocalDepResult> &Result,
DenseMap<BasicBlock*, Value*> &Visited,
bool SkipFirstBlock = false);
MemDepResult GetNonLocalInfoForBlock(Value *Pointer, uint64_t PointeeSize,