[llvm-commits] [llvm] r169697 - /llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Chandler Carruth
chandlerc at gmail.com
Sun Dec 9 03:56:01 PST 2012
Author: chandlerc
Date: Sun Dec 9 05:56:01 2012
New Revision: 169697
URL: http://llvm.org/viewvc/llvm-project?rev=169697&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=169697&r1=169696&r2=169697&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Sun Dec 9 05:56:01 2012
@@ -522,11 +522,10 @@
/// \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 @@
/// \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()));
}
}
More information about the llvm-commits
mailing list