diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-05-05 11:29:14 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-05-05 11:29:14 +0000 |
commit | e210df20d3b69beaa3e83a6088b6bafb9f00bcfe (patch) | |
tree | cac8e2750cc0d3488a7a33a8cac123cecc35068d /lib | |
parent | 46abfcf4187432da728cbe452c32143da077e07f (diff) | |
download | external_llvm-e210df20d3b69beaa3e83a6088b6bafb9f00bcfe.zip external_llvm-e210df20d3b69beaa3e83a6088b6bafb9f00bcfe.tar.gz external_llvm-e210df20d3b69beaa3e83a6088b6bafb9f00bcfe.tar.bz2 |
InlineSpiller: Remove quadratic behavior.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/InlineSpiller.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/CodeGen/InlineSpiller.cpp b/lib/CodeGen/InlineSpiller.cpp index c6d1a18..35295fe 100644 --- a/lib/CodeGen/InlineSpiller.cpp +++ b/lib/CodeGen/InlineSpiller.cpp @@ -955,18 +955,21 @@ void InlineSpiller::reMaterializeAll() { Edit->eliminateDeadDefs(DeadDefs, RegsToSpill); // Get rid of deleted and empty intervals. - for (unsigned i = RegsToSpill.size(); i != 0; --i) { - unsigned Reg = RegsToSpill[i-1]; - if (!LIS.hasInterval(Reg)) { - RegsToSpill.erase(RegsToSpill.begin() + (i - 1)); + unsigned ResultPos = 0; + for (unsigned i = 0, e = RegsToSpill.size(); i != e; ++i) { + unsigned Reg = RegsToSpill[i]; + if (!LIS.hasInterval(Reg)) continue; - } + LiveInterval &LI = LIS.getInterval(Reg); - if (!LI.empty()) + if (LI.empty()) { + Edit->eraseVirtReg(Reg); continue; - Edit->eraseVirtReg(Reg); - RegsToSpill.erase(RegsToSpill.begin() + (i - 1)); + } + + RegsToSpill[ResultPos++] = Reg; } + RegsToSpill.erase(RegsToSpill.begin() + ResultPos, RegsToSpill.end()); DEBUG(dbgs() << RegsToSpill.size() << " registers to spill after remat.\n"); } |