Minor efficiency improvement, finegrainify namespacification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-03-25 22:56:03 +00:00
parent a553f62738
commit 698c4a4bbb

View File

@ -18,8 +18,7 @@
#include "llvm/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/Type.h"
namespace llvm {
using namespace llvm;
// Register the ValueNumbering interface, providing a nice name to refer to.
static RegisterAnalysisGroup<ValueNumbering> X("Value Numbering");
@ -177,6 +176,14 @@ static bool IdenticalComplexInst(const Instruction *I1, const Instruction *I2) {
void BVNImpl::visitGetElementPtrInst(GetElementPtrInst &I) {
Value *Op = I.getOperand(0);
// Try to pick a local operand if possible instead of a constant or a global
// that might have a lot of uses.
for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i)
if (isa<Instruction>(I.getOperand(i)) || isa<Argument>(I.getOperand(i))) {
Op = I.getOperand(i);
break;
}
for (Value::use_iterator UI = Op->use_begin(), UE = Op->use_end();
UI != UE; ++UI)
@ -188,6 +195,4 @@ void BVNImpl::visitGetElementPtrInst(GetElementPtrInst &I) {
}
}
void BasicValueNumberingStub() { }
} // End llvm namespace
void llvm::BasicValueNumberingStub() { }