[llvm-commits] [llvm] r59246 - in /llvm/trunk/lib/CodeGen: LiveIntervalAnalysis.cpp LiveVariables.cpp
Dan Gohman
gohman at apple.com
Thu Nov 13 08:31:45 PST 2008
Author: djg
Date: Thu Nov 13 10:31:27 2008
New Revision: 59246
URL: http://llvm.org/viewvc/llvm-project?rev=59246&view=rev
Log:
Use find_first/find_next to iterate through all the set bits in a
BitVector, instead of manually testing each bit.
Modified:
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/lib/CodeGen/LiveVariables.cpp
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=59246&r1=59245&r2=59246&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Nov 13 10:31:27 2008
@@ -399,14 +399,13 @@
// Iterate over all of the blocks that the variable is completely
// live in, adding [insrtIndex(begin), instrIndex(end)+4) to the
// live interval.
- for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) {
- if (vi.AliveBlocks[i]) {
- LiveRange LR(getMBBStartIdx(i),
- getMBBEndIdx(i)+1, // MBB ends at -1.
- ValNo);
- interval.addRange(LR);
- DOUT << " +" << LR;
- }
+ for (int i = vi.AliveBlocks.find_first(); i != -1;
+ i = vi.AliveBlocks.find_next(i)) {
+ LiveRange LR(getMBBStartIdx(i),
+ getMBBEndIdx(i)+1, // MBB ends at -1.
+ ValNo);
+ interval.addRange(LR);
+ DOUT << " +" << LR;
}
// Finally, this virtual register is live from the start of any killing
Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=59246&r1=59245&r2=59246&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Thu Nov 13 10:31:27 2008
@@ -52,11 +52,11 @@
void LiveVariables::VarInfo::dump() const {
cerr << " Alive in blocks: ";
- for (unsigned i = 0, e = AliveBlocks.size(); i != e; ++i)
- if (AliveBlocks[i]) cerr << i << ", ";
+ for (int i = AliveBlocks.find_first(); i != -1; i = AliveBlocks.find_next(i))
+ cerr << i << ", ";
cerr << " Used in blocks: ";
- for (unsigned i = 0, e = UsedBlocks.size(); i != e; ++i)
- if (UsedBlocks[i]) cerr << i << ", ";
+ for (int i = UsedBlocks.find_first(); i != -1; i = UsedBlocks.find_next(i))
+ cerr << i << ", ";
cerr << "\n Killed by:";
if (Kills.empty())
cerr << " No instructions.\n";
More information about the llvm-commits
mailing list