From fff534d147b22f9f93814fc039d13a4dad6e4886 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Mon, 30 Jul 2007 17:29:24 +0000 Subject: [PATCH] Use more caching when computing non-local dependence. This makes bzip2 not use up the entire 32-bit address space. llvm-svn: 40596 --- lib/Analysis/MemoryDependenceAnalysis.cpp | 2 ++ lib/Transforms/Scalar/GVN.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index 4bd877142a2..02b0af6f0f9 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -129,6 +129,8 @@ bool MemoryDependenceAnalysis::nonLocalHelper(Instruction* query, if (!inserted && !predOnStack) resp.insert(std::make_pair(block, None)); + else if (inserted && predOnStack) + resp.insert(std::make_pair(block, NonLocal)); return inserted; } diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index ab6c913605e..fee0eedcc77 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -752,7 +752,9 @@ bool GVN::processNonLocalLoad(LoadInst* L, SmallVector& toErase I != E; ++I) if (I->second == MemoryDependenceAnalysis::None) { return false; - } else if (StoreInst* S = dyn_cast(I->second)) { + } else if (I->second == MemoryDependenceAnalysis::NonLocal) { + continue; + }else if (StoreInst* S = dyn_cast(I->second)) { if (S->getPointerOperand() == L->getPointerOperand()) repl.insert(std::make_pair(I->first, S->getOperand(0))); else