llvm.org GIT mirror llvm / e210df2
InlineSpiller: Remove quadratic behavior. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181149 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 7 years ago
1 changed file(s) with 14 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
954954 Edit->eliminateDeadDefs(DeadDefs, RegsToSpill);
955955
956956 // Get rid of deleted and empty intervals.
957 for (unsigned i = RegsToSpill.size(); i != 0; --i) {
958 unsigned Reg = RegsToSpill[i-1];
959 if (!LIS.hasInterval(Reg)) {
960 RegsToSpill.erase(RegsToSpill.begin() + (i - 1));
961 continue;
962 }
957 unsigned ResultPos = 0;
958 for (unsigned i = 0, e = RegsToSpill.size(); i != e; ++i) {
959 unsigned Reg = RegsToSpill[i];
960 if (!LIS.hasInterval(Reg))
961 continue;
962
963963 LiveInterval &LI = LIS.getInterval(Reg);
964 if (!LI.empty())
965 continue;
966 Edit->eraseVirtReg(Reg);
967 RegsToSpill.erase(RegsToSpill.begin() + (i - 1));
968 }
964 if (LI.empty()) {
965 Edit->eraseVirtReg(Reg);
966 continue;
967 }
968
969 RegsToSpill[ResultPos++] = Reg;
970 }
971 RegsToSpill.erase(RegsToSpill.begin() + ResultPos, RegsToSpill.end());
969972 DEBUG(dbgs() << RegsToSpill.size() << " registers to spill after remat.\n");
970973 }
971974