aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-10-10 23:04:12 +0000
committerChris Lattner <sabre@nondot.org>2009-10-10 23:04:12 +0000
commit7b06de142ad444492acf76879609cc3a99e91d18 (patch)
treee0e1f4869d3d6e85ee6968e208ef1f25cb00fdfa /lib/Transforms
parentaf354a777f57a5585a3b210d785db6349539953f (diff)
downloadexternal_llvm-7b06de142ad444492acf76879609cc3a99e91d18.zip
external_llvm-7b06de142ad444492acf76879609cc3a99e91d18.tar.gz
external_llvm-7b06de142ad444492acf76879609cc3a99e91d18.tar.bz2
remove dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/GVN.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index bd5b028..125793b 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -735,7 +735,6 @@ namespace {
Value *CollapsePhi(PHINode* p);
bool performPRE(Function& F);
Value *lookupNumber(BasicBlock *BB, uint32_t num);
- Value *AttemptRedundancyElimination(Instruction *orig, unsigned valno);
void cleanupGlobalSets();
void verifyRemoved(const Instruction *I) const;
};
@@ -1729,59 +1728,6 @@ Value *GVN::lookupNumber(BasicBlock *BB, uint32_t num) {
return 0;
}
-/// AttemptRedundancyElimination - If the "fast path" of redundancy elimination
-/// by inheritance from the dominator fails, see if we can perform phi
-/// construction to eliminate the redundancy.
-Value *GVN::AttemptRedundancyElimination(Instruction *orig, unsigned valno) {
- BasicBlock *BaseBlock = orig->getParent();
-
- SmallPtrSet<BasicBlock*, 4> Visited;
- SmallVector<BasicBlock*, 8> Stack;
- Stack.push_back(BaseBlock);
-
- DenseMap<BasicBlock*, Value*> Results;
-
- // Walk backwards through our predecessors, looking for instances of the
- // value number we're looking for. Instances are recorded in the Results
- // map, which is then used to perform phi construction.
- while (!Stack.empty()) {
- BasicBlock *Current = Stack.back();
- Stack.pop_back();
-
- // If we've walked all the way to a proper dominator, then give up. Cases
- // where the instance is in the dominator will have been caught by the fast
- // path, and any cases that require phi construction further than this are
- // probably not worth it anyways. Note that this is a SIGNIFICANT compile
- // time improvement.
- if (DT->properlyDominates(Current, orig->getParent())) return 0;
-
- DenseMap<BasicBlock*, ValueNumberScope*>::iterator LA =
- localAvail.find(Current);
- if (LA == localAvail.end()) return 0;
- DenseMap<uint32_t, Value*>::iterator V = LA->second->table.find(valno);
-
- if (V != LA->second->table.end()) {
- // Found an instance, record it.
- Results.insert(std::make_pair(Current, V->second));
- continue;
- }
-
- // If we reach the beginning of the function, then give up.
- if (pred_begin(Current) == pred_end(Current))
- return 0;
-
- for (pred_iterator PI = pred_begin(Current), PE = pred_end(Current);
- PI != PE; ++PI)
- if (Visited.insert(*PI))
- Stack.push_back(*PI);
- }
-
- // If we didn't find instances, give up. Otherwise, perform phi construction.
- if (Results.size() == 0)
- return 0;
-
- return GetValueForBlock(BaseBlock, orig, Results, true);
-}
/// processInstruction - When calculating availability, handle an instruction
/// by inserting it into the appropriate sets
@@ -1865,17 +1811,6 @@ bool GVN::processInstruction(Instruction *I,
toErase.push_back(I);
return true;
-#if 0
- // Perform slow-pathvalue-number based elimination with phi construction.
- } else if (Value *repl = AttemptRedundancyElimination(I, Num)) {
- // Remove it!
- VN.erase(I);
- I->replaceAllUsesWith(repl);
- if (isa<PointerType>(repl->getType()))
- MD->invalidateCachedPointerInfo(repl);
- toErase.push_back(I);
- return true;
-#endif
} else {
localAvail[I->getParent()]->table.insert(std::make_pair(Num, I));
}