summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-05-23 21:13:24 +0000
committerChris Lattner <sabre@nondot.org>2004-05-23 21:13:24 +0000
commit32502b8d4a6d51361279a1fdc981c2f26f4bde44 (patch)
treed843719e08d586d0e31544c5963216a9a45fd7ac /llvm/lib
parent8f2b467feb83cabfd92599fe894549d9c543d7fe (diff)
downloadbcm5719-llvm-32502b8d4a6d51361279a1fdc981c2f26f4bde44.tar.gz
bcm5719-llvm-32502b8d4a6d51361279a1fdc981c2f26f4bde44.zip
Implement the interfaces to update value numbering information. Add an
assert. llvm-svn: 13679
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/LoadValueNumbering.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoadValueNumbering.cpp b/llvm/lib/Analysis/LoadValueNumbering.cpp
index 97a57562bd7..32d574a55bd 100644
--- a/llvm/lib/Analysis/LoadValueNumbering.cpp
+++ b/llvm/lib/Analysis/LoadValueNumbering.cpp
@@ -56,6 +56,24 @@ namespace {
virtual void getEqualNumberNodes(Value *V1,
std::vector<Value*> &RetVals) const;
+ /// deleteValue - This method should be called whenever an LLVM Value is
+ /// deleted from the program, for example when an instruction is found to be
+ /// redundant and is eliminated.
+ ///
+ virtual void deleteValue(Value *V) {
+ getAnalysis<AliasAnalysis>().deleteValue(V);
+ }
+
+ /// copyValue - This method should be used whenever a preexisting value in
+ /// the program is copied or cloned, introducing a new value. Note that
+ /// analysis implementations should tolerate clients that use this method to
+ /// introduce the same value multiple times: if the analysis already knows
+ /// about a value, it should ignore the request.
+ ///
+ virtual void copyValue(Value *From, Value *To) {
+ getAnalysis<AliasAnalysis>().copyValue(From, To);
+ }
+
/// getCallEqualNumberNodes - Given a call instruction, find other calls
/// that have the same value number.
void getCallEqualNumberNodes(CallInst *CI,
@@ -103,7 +121,7 @@ static bool isPathTransparentTo(BasicBlock *CurBlock, BasicBlock *Dom,
TransparentBlocks.insert(TBI, std::make_pair(CurBlock, false));
return false;
}
- TransparentBlocks.insert(TBI, std::make_pair(CurBlock, true));
+ TransparentBlocks.insert(TBI, std::make_pair(CurBlock, true));
} else if (!TBI->second)
// This block is known non-transparent, so that path can't be either.
return false;
@@ -505,8 +523,12 @@ void LoadVN::getEqualNumberNodes(Value *V,
BasicBlock::iterator BBI = I->first->end();
while (1) {
+ assert(BBI != I->first->begin() &&
+ "There is a store in this block of the pointer, but the store"
+ " doesn't mod the address being stored to?? Must be a bug in"
+ " the alias analysis implementation!");
--BBI;
- if (AA.getModRefInfo(BBI, LoadPtr, LoadSize)& AliasAnalysis::Mod){
+ if (AA.getModRefInfo(BBI, LoadPtr, LoadSize) & AliasAnalysis::Mod) {
// If the invalidating instruction is one of the candidates,
// then it provides the value the load loads.
if (StoreInst *SI = dyn_cast<StoreInst>(BBI))
OpenPOWER on IntegriCloud