From 0ee443d169786017d151034b8bd34225bc144c98 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 22 Dec 2009 04:25:02 +0000 Subject: 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 --- include/llvm/Analysis/MemoryDependenceAnalysis.h | 44 ++++++++++++++++-------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'include') 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 &Result); + SmallVectorImpl &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 &Result, + SmallVectorImpl &Result, DenseMap &Visited, bool SkipFirstBlock = false); MemDepResult GetNonLocalInfoForBlock(Value *Pointer, uint64_t PointeeSize, -- cgit v1.1