[llvm-commits] [llvm] r104079 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Dan Gohman
gohman at apple.com
Tue May 18 15:39:15 PDT 2010
Author: djg
Date: Tue May 18 17:39:15 2010
New Revision: 104079
URL: http://llvm.org/viewvc/llvm-project?rev=104079&view=rev
Log:
Factor out the code for deleting a formula from an LSRUse into
a helper function.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=104079&r1=104078&r2=104079&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue May 18 17:39:15 2010
@@ -942,6 +942,7 @@
AllFixupsOutsideLoop(true) {}
bool InsertFormula(const Formula &F);
+ void DeleteFormula(Formula &F);
void check() const;
@@ -979,6 +980,12 @@
return true;
}
+/// DeleteFormula - Remove the given formula from this use's list.
+void LSRUse::DeleteFormula(Formula &F) {
+ std::swap(F, Formulae.back());
+ Formulae.pop_back();
+}
+
void LSRUse::print(raw_ostream &OS) const {
OS << "LSR Use: Kind=";
switch (Kind) {
@@ -2631,8 +2638,7 @@
#ifndef NDEBUG
Changed = true;
#endif
- std::swap(F, LU.Formulae.back());
- LU.Formulae.pop_back();
+ LU.DeleteFormula(F);
--FIdx;
--NumForms;
continue;
@@ -2728,8 +2734,7 @@
Formula &F = LU.Formulae[i];
if (!F.referencesReg(Best)) {
DEBUG(dbgs() << " Deleting "; F.print(dbgs()); dbgs() << '\n');
- std::swap(LU.Formulae.back(), F);
- LU.Formulae.pop_back();
+ LU.DeleteFormula(F);
--e;
--i;
assert(e != 0 && "Use has no formulae left! Is Regs inconsistent?");
More information about the llvm-commits
mailing list