InlineSpiller: Store bucket pointers instead of iterators.

Lets us use a SetVector instead of an explicit set + vector combination.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182586 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2013-05-23 15:42:57 +00:00
parent 061ff3409d
commit 2db14ba90c

View File

@ -14,6 +14,7 @@
#define DEBUG_TYPE "regalloc"
#include "Spiller.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
@ -337,10 +338,12 @@ static raw_ostream &operator<<(raw_ostream &OS,
/// propagateSiblingValue - Propagate the value in SVI to dependents if it is
/// known. Otherwise remember the dependency for later.
///
/// @param SVI SibValues entry to propagate.
/// @param SVIIter SibValues entry to propagate.
/// @param VNI Dependent value, or NULL to propagate to all saved dependents.
void InlineSpiller::propagateSiblingValue(SibValueMap::iterator SVI,
void InlineSpiller::propagateSiblingValue(SibValueMap::iterator SVIIter,
VNInfo *VNI) {
SibValueMap::value_type *SVI = &*SVIIter;
// When VNI is non-NULL, add it to SVI's deps, and only propagate to that.
TinyPtrVector<VNInfo*> FirstDeps;
if (VNI) {
@ -352,14 +355,12 @@ void InlineSpiller::propagateSiblingValue(SibValueMap::iterator SVI,
if (!SVI->second.hasDef())
return;
// Work list of values to propagate. It would be nice to use a SetVector
// here, but then we would be forced to use a SmallSet.
SmallVector<SibValueMap::iterator, 8> WorkList(1, SVI);
SmallPtrSet<VNInfo*, 8> WorkSet;
// Work list of values to propagate.
SmallSetVector<SibValueMap::value_type *, 8> WorkList;
WorkList.insert(SVI);
do {
SVI = WorkList.pop_back_val();
WorkSet.erase(SVI->first);
TinyPtrVector<VNInfo*> *Deps = VNI ? &FirstDeps : &SVI->second.Deps;
VNI = 0;
@ -450,8 +451,7 @@ void InlineSpiller::propagateSiblingValue(SibValueMap::iterator SVI,
continue;
// Something changed in DepSVI. Propagate to dependents.
if (WorkSet.insert(DepSVI->first))
WorkList.push_back(DepSVI);
WorkList.insert(&*DepSVI);
DEBUG(dbgs() << " update " << DepSVI->first->id << '@'
<< DepSVI->first->def << " to:\t" << DepSV);