From: Chris Lattner Date: Fri, 21 Mar 2008 22:01:16 +0000 (+0000) Subject: the size of a smallvector shouldn't be part of the interface to these methods. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8e1e95cb043c9eb7766d283587cd0a830b1f3209;p=oota-llvm.git the size of a smallvector shouldn't be part of the interface to these methods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48662 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index eb91b5a043d..3c24f05c205 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -664,18 +664,18 @@ namespace { Value* find_leader(ValueNumberedSet& vals, uint32_t v) ; void val_insert(ValueNumberedSet& s, Value* v); bool processLoad(LoadInst* L, - DenseMap& lastLoad, - SmallVector& toErase); + DenseMap &lastLoad, + SmallVectorImpl &toErase); bool processInstruction(Instruction* I, ValueNumberedSet& currAvail, DenseMap& lastSeenLoad, - SmallVector& toErase); + SmallVectorImpl &toErase); bool processNonLocalLoad(LoadInst* L, - SmallVector& toErase); + SmallVectorImpl &toErase); bool processMemCpy(MemCpyInst* M, MemCpyInst* MDep, - SmallVector& toErase); + SmallVectorImpl &toErase); bool performCallSlotOptzn(MemCpyInst* cpy, CallInst* C, - SmallVector& toErase); + SmallVectorImpl &toErase); Value *GetValueForBlock(BasicBlock *BB, LoadInst* orig, DenseMap &Phis, bool top_level = false); @@ -824,7 +824,7 @@ Value *GVN::GetValueForBlock(BasicBlock *BB, LoadInst* orig, /// processNonLocalLoad - Attempt to eliminate a load whose dependencies are /// non-local by performing PHI construction. bool GVN::processNonLocalLoad(LoadInst* L, - SmallVector& toErase) { + SmallVectorImpl &toErase) { MemoryDependenceAnalysis& MD = getAnalysis(); // Find the non-local dependencies of the load @@ -884,9 +884,8 @@ bool GVN::processNonLocalLoad(LoadInst* L, /// processLoad - Attempt to eliminate a load, first by eliminating it /// locally, and then attempting non-local elimination if that fails. -bool GVN::processLoad(LoadInst* L, - DenseMap& lastLoad, - SmallVector& toErase) { +bool GVN::processLoad(LoadInst *L, DenseMap &lastLoad, + SmallVectorImpl &toErase) { if (L->isVolatile()) { lastLoad[L->getPointerOperand()] = L; return false; @@ -987,8 +986,8 @@ bool GVN::processLoad(LoadInst* L, /// performCallSlotOptzn - takes a memcpy and a call that it depends on, /// and checks for the possibility of a call slot optimization by having /// the call write its result directly into the destination of the memcpy. -bool GVN::performCallSlotOptzn(MemCpyInst* cpy, CallInst* C, - SmallVector& toErase) { +bool GVN::performCallSlotOptzn(MemCpyInst *cpy, CallInst *C, + SmallVectorImpl &toErase) { // The general transformation to keep in mind is // // call @func(..., src, ...) @@ -1066,7 +1065,6 @@ bool GVN::performCallSlotOptzn(MemCpyInst* cpy, CallInst* C, // guarantees that it holds only undefined values when passed in (so the final // memcpy can be dropped), that it is not read or written between the call and // the memcpy, and that writing beyond the end of it is undefined. - SmallVector srcUseList(srcAlloca->use_begin(), srcAlloca->use_end()); while (!srcUseList.empty()) { @@ -1124,7 +1122,7 @@ bool GVN::performCallSlotOptzn(MemCpyInst* cpy, CallInst* C, /// a memcpy from X to Z (or potentially a memmove, depending on circumstances). /// This allows later passes to remove the first memcpy altogether. bool GVN::processMemCpy(MemCpyInst* M, MemCpyInst* MDep, - SmallVector& toErase) { + SmallVectorImpl &toErase) { // We can only transforms memcpy's where the dest of one is the source of the // other if (M->getSource() != MDep->getDest()) @@ -1183,13 +1181,13 @@ bool GVN::processMemCpy(MemCpyInst* M, MemCpyInst* MDep, /// processInstruction - When calculating availability, handle an instruction /// by inserting it into the appropriate sets -bool GVN::processInstruction(Instruction* I, - ValueNumberedSet& currAvail, - DenseMap& lastSeenLoad, - SmallVector& toErase) { - if (LoadInst* L = dyn_cast(I)) { +bool GVN::processInstruction(Instruction *I, ValueNumberedSet &currAvail, + DenseMap &lastSeenLoad, + SmallVectorImpl &toErase) { + if (LoadInst* L = dyn_cast(I)) return processLoad(L, lastSeenLoad, toErase); - } else if (MemCpyInst* M = dyn_cast(I)) { + + if (MemCpyInst* M = dyn_cast(I)) { MemoryDependenceAnalysis& MD = getAnalysis(); // The are two possible optimizations we can do for memcpy: