summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-07-02 01:44:29 +0000
committerDevang Patel <dpatel@apple.com>2008-07-02 01:44:29 +0000
commited50fb5b61ef85a005fd181c0bee09e7c8404c9a (patch)
tree399197f8d62b0d409996d21f357527b871e52b6f /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
parent57d94d6304b11892dfd4cb094feb8e45b4ab728e (diff)
downloadbcm5719-llvm-ed50fb5b61ef85a005fd181c0bee09e7c8404c9a.tar.gz
bcm5719-llvm-ed50fb5b61ef85a005fd181c0bee09e7c8404c9a.zip
reuse vectors.
llvm-svn: 53007
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 080b8737904..1b94d9c29d0 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -85,6 +85,13 @@ namespace {
/// OrigLoopExitMap - This is used to map loop exiting block with
/// corresponding loop exit block, before updating CFG.
DenseMap<BasicBlock *, BasicBlock *> OrigLoopExitMap;
+
+ // LoopBlocks contains all of the basic blocks of the loop, including the
+ // preheader of the loop, the body of the loop, and the exit blocks of the
+ // loop, in that order.
+ std::vector<BasicBlock*> LoopBlocks;
+ // NewBlocks contained cloned copy of basic blocks from LoopBlocks.
+ std::vector<BasicBlock*> NewBlocks;
public:
static char ID; // Pass ID, replacement for typeid
explicit LoopUnswitch(bool Os = false) :
@@ -761,10 +768,8 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
<< " blocks] in Function " << F->getName()
<< " when '" << *Val << "' == " << *LIC << "\n";
- // LoopBlocks contains all of the basic blocks of the loop, including the
- // preheader of the loop, the body of the loop, and the exit blocks of the
- // loop, in that order.
- std::vector<BasicBlock*> LoopBlocks;
+ LoopBlocks.clear();
+ NewBlocks.clear();
// First step, split the preheader and exit blocks, and add these blocks to
// the LoopBlocks list.
@@ -792,7 +797,6 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
// Next step, clone all of the basic blocks that make up the loop (including
// the loop preheader and exit blocks), keeping track of the mapping between
// the instructions and blocks.
- std::vector<BasicBlock*> NewBlocks;
NewBlocks.reserve(LoopBlocks.size());
DenseMap<const Value*, Value*> ValueMap;
for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) {
OpenPOWER on IntegriCloud