diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-18 01:43:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-18 01:43:58 +0000 |
commit | 7b70bef7c800af45b07b2b563f6f81267e6c68c8 (patch) | |
tree | eeaaeca97dd678906395ee2a5f90f69645bf40bd | |
parent | a8680dced2cf940f8cba1b89f93a70fa22ac3918 (diff) | |
download | bcm5719-llvm-7b70bef7c800af45b07b2b563f6f81267e6c68c8.tar.gz bcm5719-llvm-7b70bef7c800af45b07b2b563f6f81267e6c68c8.zip |
fix a warning in TinyPtrVector, adopt it in SSAUpdater, saving some
mallocs.
llvm-svn: 135366
-rw-r--r-- | llvm/include/llvm/ADT/TinyPtrVector.h | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/SSAUpdater.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/include/llvm/ADT/TinyPtrVector.h b/llvm/include/llvm/ADT/TinyPtrVector.h index e1dc3df5616..8fbd6f61e27 100644 --- a/llvm/include/llvm/ADT/TinyPtrVector.h +++ b/llvm/include/llvm/ADT/TinyPtrVector.h @@ -98,7 +98,7 @@ public: void clear() { // If we have a single value, convert to empty. - if (EltTy V = Val.template dyn_cast<EltTy>()) { + if (Val.template is<EltTy>()) { Val = (EltTy)0; } else if (VecTy *Vec = Val.template dyn_cast<VecTy*>()) { // If we have a vector form, just clear it. diff --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp index b47a7ccd80b..d2ff8aea384 100644 --- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp +++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp @@ -16,6 +16,7 @@ #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/TinyPtrVector.h" #include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Support/AlignOf.h" #include "llvm/Support/Allocator.h" @@ -378,8 +379,7 @@ run(const SmallVectorImpl<Instruction*> &Insts) const { // First step: bucket up uses of the alloca by the block they occur in. // This is important because we have to handle multiple defs/uses in a block // ourselves: SSAUpdater is purely for cross-block references. - // FIXME: Want a TinyVector<Instruction*> since there is often 0/1 element. - DenseMap<BasicBlock*, std::vector<Instruction*> > UsesByBlock; + DenseMap<BasicBlock*, TinyPtrVector<Instruction*> > UsesByBlock; for (unsigned i = 0, e = Insts.size(); i != e; ++i) { Instruction *User = Insts[i]; @@ -395,7 +395,7 @@ run(const SmallVectorImpl<Instruction*> &Insts) const { for (unsigned i = 0, e = Insts.size(); i != e; ++i) { Instruction *User = Insts[i]; BasicBlock *BB = User->getParent(); - std::vector<Instruction*> &BlockUses = UsesByBlock[BB]; + TinyPtrVector<Instruction*> &BlockUses = UsesByBlock[BB]; // If this block has already been processed, ignore this repeat use. if (BlockUses.empty()) continue; |