summaryrefslogtreecommitdiff
path: root/lib/Analysis/LoadValueNumbering.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-29 06:20:55 +0000
committerChris Lattner <sabre@nondot.org>2005-01-29 06:20:55 +0000
commite212d62a340798e6c7d59c52b7b72622388ab114 (patch)
treef0ff928a5851d1f3bc62df0d1f40bc8caf8dfce1 /lib/Analysis/LoadValueNumbering.cpp
parente233b8c64bf0d5afeff2041b844689a3994a2848 (diff)
downloadllvm-e212d62a340798e6c7d59c52b7b72622388ab114.tar.gz
llvm-e212d62a340798e6c7d59c52b7b72622388ab114.tar.bz2
llvm-e212d62a340798e6c7d59c52b7b72622388ab114.tar.xz
Minor simplification/speedup. Replaces a set lookup with a pointer comparison.
This speeds up 176.gcc from 25.73s to 23.48s, which is 9.5% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoadValueNumbering.cpp')
-rw-r--r--lib/Analysis/LoadValueNumbering.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Analysis/LoadValueNumbering.cpp b/lib/Analysis/LoadValueNumbering.cpp
index 32dfdc84e5..2c2b136d2d 100644
--- a/lib/Analysis/LoadValueNumbering.cpp
+++ b/lib/Analysis/LoadValueNumbering.cpp
@@ -285,7 +285,6 @@ void LoadVN::getEqualNumberNodes(Value *V,
return getAnalysis<ValueNumbering>().getEqualNumberNodes(V, RetVals);
Value *PointerSource = LI->getOperand(0);
-
BasicBlock *LoadBB = LI->getParent();
Function *F = LoadBB->getParent();
@@ -333,7 +332,7 @@ void LoadVN::getEqualNumberNodes(Value *V,
// If this instruction is a candidate load before LI, we know there are no
// invalidating instructions between it and LI, so they have the same value
// number.
- if (isa<LoadInst>(I) && Instrs.count(I)) {
+ if (isa<LoadInst>(I) && cast<LoadInst>(I)->getOperand(0) == PointerSource) {
RetVals.push_back(I);
Instrs.erase(I);
} else if (AllocationInst *AI = dyn_cast<AllocationInst>(I)) {
@@ -350,7 +349,7 @@ void LoadVN::getEqualNumberNodes(Value *V,
// If the invalidating instruction is a store, and its in our candidate
// set, then we can do store-load forwarding: the load has the same value
// # as the stored value.
- if (isa<StoreInst>(I) && Instrs.count(I)) {
+ if (isa<StoreInst>(I) && I->getOperand(1) == PointerSource) {
Instrs.erase(I);
RetVals.push_back(I->getOperand(0));
}
@@ -368,7 +367,7 @@ void LoadVN::getEqualNumberNodes(Value *V,
for (BasicBlock::iterator I = LI->getNext(); I != LoadBB->end(); ++I) {
// If this instruction is a load, then this instruction returns the same
// value as LI.
- if (isa<LoadInst>(I) && Instrs.count(I)) {
+ if (isa<LoadInst>(I) && cast<LoadInst>(I)->getOperand(0) == PointerSource) {
RetVals.push_back(I);
Instrs.erase(I);
}