aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-08-21 00:31:24 +0000
committerDevang Patel <dpatel@apple.com>2007-08-21 00:31:24 +0000
commitb7211a2ce13a0365e0e1dd2f27adda2ee3d1288b (patch)
treeb9ad502a1f6b2bc11758d76401b46b4660a6e4d4 /lib/Transforms
parent2d691333acec66118ede55b6d7ec7a3083bc1e01 (diff)
downloadexternal_llvm-b7211a2ce13a0365e0e1dd2f27adda2ee3d1288b.zip
external_llvm-b7211a2ce13a0365e0e1dd2f27adda2ee3d1288b.tar.gz
external_llvm-b7211a2ce13a0365e0e1dd2f27adda2ee3d1288b.tar.bz2
Use SmallVector instead of std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41207 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/LoopExtractor.cpp2
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp4
-rw-r--r--lib/Transforms/Scalar/LICM.cpp6
-rw-r--r--lib/Transforms/Scalar/LoopRotation.cpp2
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp2
-rw-r--r--lib/Transforms/Utils/LCSSA.cpp12
-rw-r--r--lib/Transforms/Utils/LoopSimplify.cpp2
7 files changed, 14 insertions, 16 deletions
diff --git a/lib/Transforms/IPO/LoopExtractor.cpp b/lib/Transforms/IPO/LoopExtractor.cpp
index 80c1e1a..6afcf29 100644
--- a/lib/Transforms/IPO/LoopExtractor.cpp
+++ b/lib/Transforms/IPO/LoopExtractor.cpp
@@ -104,7 +104,7 @@ bool LoopExtractor::runOnFunction(Function &F) {
else {
// Check to see if any exits from the loop are more than just return
// blocks.
- std::vector<BasicBlock*> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
TLL->getExitBlocks(ExitBlocks);
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i)
if (!isa<ReturnInst>(ExitBlocks[i]->getTerminator())) {
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 01b7481..7f0e65e 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -224,7 +224,7 @@ Instruction *IndVarSimplify::LinearFunctionTestReplace(Loop *L,
SCEVExpander &RW) {
// Find the exit block for the loop. We can currently only handle loops with
// a single exit.
- std::vector<BasicBlock*> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
L->getExitBlocks(ExitBlocks);
if (ExitBlocks.size() != 1) return 0;
BasicBlock *ExitBlock = ExitBlocks[0];
@@ -309,7 +309,7 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L) {
// We insert the code into the preheader of the loop if the loop contains
// multiple exit blocks, or in the exit block if there is exactly one.
BasicBlock *BlockToInsertInto;
- std::vector<BasicBlock*> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
L->getUniqueExitBlocks(ExitBlocks);
if (ExitBlocks.size() == 1)
BlockToInsertInto = ExitBlocks[0];
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 7f4d783..ac927da 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -446,7 +446,7 @@ bool LICM::isLoopInvariantInst(Instruction &I) {
void LICM::sink(Instruction &I) {
DOUT << "LICM sinking instruction: " << I;
- std::vector<BasicBlock*> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
CurLoop->getExitBlocks(ExitBlocks);
if (isa<LoadInst>(I)) ++NumMovedLoads;
@@ -623,7 +623,7 @@ bool LICM::isSafeToExecuteUnconditionally(Instruction &Inst) {
return true;
// Get the exit blocks for the current loop.
- std::vector<BasicBlock*> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
CurLoop->getExitBlocks(ExitBlocks);
// For each exit block, get the DT node and walk up the DT until the
@@ -725,7 +725,7 @@ void LICM::PromoteValuesInLoop() {
//
std::set<BasicBlock*> ProcessedBlocks;
- std::vector<BasicBlock*> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
CurLoop->getExitBlocks(ExitBlocks);
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i)
if (ProcessedBlocks.insert(ExitBlocks[i]).second) {
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp
index a9c3fb9..c2e0d23 100644
--- a/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/lib/Transforms/Scalar/LoopRotation.cpp
@@ -157,7 +157,7 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) {
// Keep it simple, and restrict loop rotation to loops with one exit only.
// In future, lift this restriction and support for multiple exits if
// required.
- std::vector<BasicBlock *> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
L->getExitBlocks(ExitBlocks);
if (ExitBlocks.size() > 1)
return false;
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index f0c09e6..2f08722 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -622,7 +622,7 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
// We want the loop to come after the preheader, but before the exit blocks.
LoopBlocks.insert(LoopBlocks.end(), L->block_begin(), L->block_end());
- std::vector<BasicBlock*> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
L->getUniqueExitBlocks(ExitBlocks);
// Split all of the edges from inside the loop to their exit blocks. Update
diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp
index 465214c..a936666 100644
--- a/lib/Transforms/Utils/LCSSA.cpp
+++ b/lib/Transforms/Utils/LCSSA.cpp
@@ -59,7 +59,7 @@ namespace {
virtual bool runOnLoop(Loop *L, LPPassManager &LPM);
void ProcessInstruction(Instruction* Instr,
- const std::vector<BasicBlock*>& exitBlocks);
+ const SmallVector<BasicBlock*, 8>& exitBlocks);
/// This transformation requires natural loop information & requires that
/// loop preheaders be inserted into the CFG. It maintains both of these,
@@ -107,7 +107,6 @@ bool LCSSA::runOnLoop(Loop *L, LPPassManager &LPM) {
LI = &LPM.getAnalysis<LoopInfo>();
DT = &getAnalysis<DominatorTree>();
- DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>();
// Speed up queries by creating a sorted list of blocks
LoopBlocks.clear();
@@ -122,9 +121,8 @@ bool LCSSA::runOnLoop(Loop *L, LPPassManager &LPM) {
if (AffectedValues.empty())
return false;
- std::vector<BasicBlock*> exitBlocks;
- L->getExitBlocks(exitBlocks);
-
+ SmallVector<BasicBlock*, 8> exitBlocks;
+ L->getExitBlocks(exitBlocks);
// Iterate over all affected values for this loop and insert Phi nodes
// for them in the appropriate exit blocks
@@ -141,7 +139,7 @@ bool LCSSA::runOnLoop(Loop *L, LPPassManager &LPM) {
/// processInstruction - Given a live-out instruction, insert LCSSA Phi nodes,
/// eliminate all out-of-loop uses.
void LCSSA::ProcessInstruction(Instruction *Instr,
- const std::vector<BasicBlock*>& exitBlocks) {
+ const SmallVector<BasicBlock*, 8>& exitBlocks) {
++NumLCSSA; // We are applying the transformation
// Keep track of the blocks that have the value available already.
@@ -151,7 +149,7 @@ void LCSSA::ProcessInstruction(Instruction *Instr,
// Insert the LCSSA phi's into the exit blocks (dominated by the value), and
// add them to the Phi's map.
- for (std::vector<BasicBlock*>::const_iterator BBI = exitBlocks.begin(),
+ for (SmallVector<BasicBlock*, 8>::const_iterator BBI = exitBlocks.begin(),
BBE = exitBlocks.end(); BBI != BBE; ++BBI) {
BasicBlock *BB = *BBI;
DomTreeNode *ExitBBNode = DT->getNode(BB);
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp
index 226f364..20eecd6 100644
--- a/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/lib/Transforms/Utils/LoopSimplify.cpp
@@ -199,7 +199,7 @@ ReprocessLoop:
// predecessors that are inside of the loop. This check guarantees that the
// loop preheader/header will dominate the exit blocks. If the exit block has
// predecessors from outside of the loop, split the edge now.
- std::vector<BasicBlock*> ExitBlocks;
+ SmallVector<BasicBlock*, 8> ExitBlocks;
L->getExitBlocks(ExitBlocks);
SetVector<BasicBlock*> ExitBlockSet(ExitBlocks.begin(), ExitBlocks.end());