[llvm-commits] [llvm] r80202 - in /llvm/trunk: include/llvm/Transforms/Utils/Cloning.h lib/Transforms/Utils/CloneFunction.cpp lib/Transforms/Utils/CloneModule.cpp lib/Transforms/Utils/InlineFunction.cpp
Chris Lattner
sabre at nondot.org
Wed Aug 26 21:02:31 PDT 2009
Author: lattner
Date: Wed Aug 26 23:02:30 2009
New Revision: 80202
URL: http://llvm.org/viewvc/llvm-project?rev=80202&view=rev
Log:
smallvectorize the list of returns built by CloneAndPruneFunctionInto.
Modified:
llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Modified: llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Cloning.h?rev=80202&r1=80201&r2=80202&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Cloning.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Cloning.h Wed Aug 26 23:02:30 2009
@@ -18,7 +18,6 @@
#ifndef LLVM_TRANSFORMS_UTILS_CLONING_H
#define LLVM_TRANSFORMS_UTILS_CLONING_H
-#include <vector>
#include "llvm/ADT/DenseMap.h"
namespace llvm {
@@ -39,6 +38,7 @@
class Loop;
class LoopInfo;
class LLVMContext;
+template <typename T> class SmallVectorImpl;
/// CloneModule - Return an exact copy of the specified module
///
@@ -137,7 +137,7 @@
///
void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
DenseMap<const Value*, Value*> &ValueMap,
- std::vector<ReturnInst*> &Returns,
+ SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix = "",
ClonedCodeInfo *CodeInfo = 0);
@@ -150,7 +150,7 @@
/// used for things like CloneFunction or CloneModule.
void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
DenseMap<const Value*, Value*> &ValueMap,
- std::vector<ReturnInst*> &Returns,
+ SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix = "",
ClonedCodeInfo *CodeInfo = 0,
const TargetData *TD = 0);
Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=80202&r1=80201&r2=80202&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Wed Aug 26 23:02:30 2009
@@ -73,7 +73,7 @@
//
void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
DenseMap<const Value*, Value*> &ValueMap,
- std::vector<ReturnInst*> &Returns,
+ SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix, ClonedCodeInfo *CodeInfo) {
assert(NameSuffix && "NameSuffix cannot be null!");
@@ -166,7 +166,7 @@
ValueMap[I] = DestI++; // Add mapping to ValueMap
}
- std::vector<ReturnInst*> Returns; // Ignore returns cloned...
+ SmallVector<ReturnInst*, 8> Returns; // Ignore returns cloned.
CloneFunctionInto(NewF, F, ValueMap, Returns, "", CodeInfo);
return NewF;
}
@@ -180,7 +180,7 @@
Function *NewFunc;
const Function *OldFunc;
DenseMap<const Value*, Value*> &ValueMap;
- std::vector<ReturnInst*> &Returns;
+ SmallVectorImpl<ReturnInst*> &Returns;
const char *NameSuffix;
ClonedCodeInfo *CodeInfo;
const TargetData *TD;
@@ -188,7 +188,7 @@
public:
PruningFunctionCloner(Function *newFunc, const Function *oldFunc,
DenseMap<const Value*, Value*> &valueMap,
- std::vector<ReturnInst*> &returns,
+ SmallVectorImpl<ReturnInst*> &returns,
const char *nameSuffix,
ClonedCodeInfo *codeInfo,
const TargetData *td)
@@ -361,7 +361,7 @@
/// used for things like CloneFunction or CloneModule.
void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
DenseMap<const Value*, Value*> &ValueMap,
- std::vector<ReturnInst*> &Returns,
+ SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix,
ClonedCodeInfo *CodeInfo,
const TargetData *TD) {
@@ -391,7 +391,7 @@
// insert it into the new function in the right order. If not, ignore it.
//
// Defer PHI resolution until rest of function is resolved.
- std::vector<const PHINode*> PHIToResolve;
+ SmallVector<const PHINode*, 16> PHIToResolve;
for (Function::const_iterator BI = OldFunc->begin(), BE = OldFunc->end();
BI != BE; ++BI) {
BasicBlock *NewBB = cast_or_null<BasicBlock>(ValueMap[BI]);
Modified: llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneModule.cpp?rev=80202&r1=80201&r2=80202&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneModule.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneModule.cpp Wed Aug 26 23:02:30 2009
@@ -108,7 +108,7 @@
ValueMap[J] = DestI++;
}
- std::vector<ReturnInst*> Returns; // Ignore returns cloned...
+ SmallVector<ReturnInst*, 8> Returns; // Ignore returns cloned.
CloneFunctionInto(F, I, ValueMap, Returns);
}
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=80202&r1=80201&r2=80202&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Wed Aug 26 23:02:30 2009
@@ -307,7 +307,7 @@
// Make sure to capture all of the return instructions from the cloned
// function.
- std::vector<ReturnInst*> Returns;
+ SmallVector<ReturnInst*, 8> Returns;
ClonedCodeInfo InlinedFunctionInfo;
Function::iterator FirstNewBlock;
More information about the llvm-commits
mailing list