diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-11 03:57:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-11 03:57:16 +0000 |
commit | 6e445dc299c96cff2e2b75400a734e95fbcd2163 (patch) | |
tree | 876de9ba650d16f52e14a6d26f24bd7e2cb22bbc /llvm/lib/Analysis/ValueNumbering.cpp | |
parent | 18d1f19fbab69dae0107ec55d5b3057a5c63b6ad (diff) | |
download | bcm5719-llvm-6e445dc299c96cff2e2b75400a734e95fbcd2163.tar.gz bcm5719-llvm-6e445dc299c96cff2e2b75400a734e95fbcd2163.zip |
Simplify implementation, and probably speed things up too.
llvm-svn: 11308
Diffstat (limited to 'llvm/lib/Analysis/ValueNumbering.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueNumbering.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/ValueNumbering.cpp b/llvm/lib/Analysis/ValueNumbering.cpp index d472651b3ea..0d016f32288 100644 --- a/llvm/lib/Analysis/ValueNumbering.cpp +++ b/llvm/lib/Analysis/ValueNumbering.cpp @@ -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 @@ void BVNImpl::visitCastInst(CastInst &CI) { 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); } |