diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-12-09 11:56:01 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-12-09 11:56:01 +0000 |
commit | 0da9175d90bcd202810ebef1b51d18d9ed0f9a98 (patch) | |
tree | db2232f44803c03a86c3a6f3249e15cec11bc6a8 /lib/Transforms/Scalar/SROA.cpp | |
parent | f81093a826f815596d7db8e93abd71021384c4fd (diff) | |
download | external_llvm-0da9175d90bcd202810ebef1b51d18d9ed0f9a98.zip external_llvm-0da9175d90bcd202810ebef1b51d18d9ed0f9a98.tar.gz external_llvm-0da9175d90bcd202810ebef1b51d18d9ed0f9a98.tar.bz2 |
Switch SROA to pop Uses off the back of its visitors' queues.
This will more closely match the behavior of the new PtrUseVisitor that
I am adding. Hopefully this will not change the actual behavior in any
way, but by making the processing order more similar help in debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SROA.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SROA.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp index cb9838e..a4b8b47 100644 --- a/lib/Transforms/Scalar/SROA.cpp +++ b/lib/Transforms/Scalar/SROA.cpp @@ -522,11 +522,10 @@ public: /// \brief Run the builder over the allocation. bool operator()() { - // Note that we have to re-evaluate size on each trip through the loop as - // the queue grows at the tail. - for (unsigned Idx = 0; Idx < Queue.size(); ++Idx) { - U = Queue[Idx].U; - Offset = Queue[Idx].Offset; + while (!Queue.empty()) { + U = Queue.back().U; + Offset = Queue.back().Offset; + Queue.pop_back(); if (!visit(cast<Instruction>(U->getUser()))) return false; } @@ -851,11 +850,10 @@ public: /// \brief Run the builder over the allocation. void operator()() { - // Note that we have to re-evaluate size on each trip through the loop as - // the queue grows at the tail. - for (unsigned Idx = 0; Idx < Queue.size(); ++Idx) { - U = Queue[Idx].U; - Offset = Queue[Idx].Offset; + while (!Queue.empty()) { + U = Queue.back().U; + Offset = Queue.back().Offset; + Queue.pop_back(); this->visit(cast<Instruction>(U->getUser())); } } |