summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-18 22:39:15 +0000
committerDan Gohman <gohman@apple.com>2010-05-18 22:39:15 +0000
commitf1c7b1b42f236162a377f7c25c575ce8de089478 (patch)
tree9b8913f0b4b68a7011fb58bdd07af6e237467a3f /llvm/lib/Transforms
parent8aca7ef9032abdbeb110fa52486d4f598e8c02fe (diff)
downloadbcm5719-llvm-f1c7b1b42f236162a377f7c25c575ce8de089478.tar.gz
bcm5719-llvm-f1c7b1b42f236162a377f7c25c575ce8de089478.zip
Factor out the code for deleting a formula from an LSRUse into
a helper function. llvm-svn: 104079
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index eaf8d945bbe..eac1a023bb6 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -942,6 +942,7 @@ public:
AllFixupsOutsideLoop(true) {}
bool InsertFormula(const Formula &F);
+ void DeleteFormula(Formula &F);
void check() const;
@@ -979,6 +980,12 @@ bool LSRUse::InsertFormula(const Formula &F) {
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 @@ void LSRInstance::FilterOutUndesirableDedicatedRegisters() {
#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 @@ void LSRInstance::NarrowSearchSpaceUsingHeuristics() {
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?");
OpenPOWER on IntegriCloud