[llvm-commits] CVS: llvm/lib/Analysis/ValueNumbering.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Mar 25 16:57:01 PST 2004
Changes in directory llvm/lib/Analysis:
ValueNumbering.cpp updated: 1.10 -> 1.11
---
Log message:
Minor efficiency improvement, finegrainify namespacification
---
Diffs of the changes: (+10 -5)
Index: llvm/lib/Analysis/ValueNumbering.cpp
diff -u llvm/lib/Analysis/ValueNumbering.cpp:1.10 llvm/lib/Analysis/ValueNumbering.cpp:1.11
--- llvm/lib/Analysis/ValueNumbering.cpp:1.10 Tue Feb 10 21:57:16 2004
+++ llvm/lib/Analysis/ValueNumbering.cpp Thu Mar 25 16:56:03 2004
@@ -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 @@
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 BasicValueNumberingStub() { }
-
-} // End llvm namespace
+void llvm::BasicValueNumberingStub() { }
More information about the llvm-commits
mailing list