[llvm-commits] CVS: llvm/lib/Analysis/ValueNumbering.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Feb 10 21:58:01 PST 2004
Changes in directory llvm/lib/Analysis:
ValueNumbering.cpp updated: 1.9 -> 1.10
---
Log message:
Simplify implementation, and probably speed things up too.
---
Diffs of the changes: (+6 -9)
Index: llvm/lib/Analysis/ValueNumbering.cpp
diff -u llvm/lib/Analysis/ValueNumbering.cpp:1.9 llvm/lib/Analysis/ValueNumbering.cpp:1.10
--- llvm/lib/Analysis/ValueNumbering.cpp:1.9 Wed Dec 10 23:05:56 2003
+++ llvm/lib/Analysis/ValueNumbering.cpp Tue Feb 10 21:57:16 2004
@@ -15,9 +15,9 @@
#include "llvm/Analysis/ValueNumbering.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/BasicBlock.h"
+#include "llvm/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/Type.h"
-#include "llvm/iMemory.h"
namespace llvm {
@@ -104,17 +104,14 @@
for (Value::use_iterator UI = Op->use_begin(), UE = Op->use_end();
UI != UE; ++UI)
- if (Instruction *Other = dyn_cast<Instruction>(*UI))
- // Check to see if this new cast is not I, but has the same operand...
- if (Other != &I && Other->getOpcode() == I.getOpcode() &&
- Other->getOperand(0) == Op && // Is the operand the same?
+ if (CastInst *Other = dyn_cast<CastInst>(*UI))
+ // Check that the types are the same, since this code handles casts...
+ if (Other->getType() == I.getType() &&
// Is it embedded in the same function? (This could be false if LHS
// is a constant or global!)
Other->getParent()->getParent() == F &&
-
- // Check that the types are the same, since this code handles casts...
- Other->getType() == I.getType()) {
-
+ // Check to see if this new cast is not I.
+ Other != &I) {
// These instructions are identical. Add to list...
RetVals.push_back(Other);
}
More information about the llvm-commits
mailing list