diff options
| author | Matthew Simpson <mssimpso@codeaurora.org> | 2017-10-10 22:14:12 +0000 |
|---|---|---|
| committer | Matthew Simpson <mssimpso@codeaurora.org> | 2017-10-10 22:14:12 +0000 |
| commit | 82744da47bf26bd534ab82efbe07df9167e1219a (patch) | |
| tree | 9d80b5a1d4716e100b6f760e62a62db6d15d0c2c | |
| parent | 4a6ee430bb4ee959f07999f73987bbd0990e831c (diff) | |
| download | bcm5719-llvm-82744da47bf26bd534ab82efbe07df9167e1219a.tar.gz bcm5719-llvm-82744da47bf26bd534ab82efbe07df9167e1219a.zip | |
[SparsePropagation] Let the Instruction work list hold Values.
llvm-svn: 315375
| -rw-r--r-- | llvm/include/llvm/Analysis/SparsePropagation.h | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/llvm/include/llvm/Analysis/SparsePropagation.h b/llvm/include/llvm/Analysis/SparsePropagation.h index 1a7fded7904..a51ac16c5bb 100644 --- a/llvm/include/llvm/Analysis/SparsePropagation.h +++ b/llvm/include/llvm/Analysis/SparsePropagation.h @@ -111,8 +111,8 @@ template <class LatticeVal> class SparseSolver { /// BBExecutable - Holds the basic blocks that are executable. SmallPtrSet<BasicBlock *, 16> BBExecutable; - /// InstWorkList - Holds instructions that should be processed. - SmallVector<Instruction *, 64> InstWorkList; + /// ValueWorkList - Holds values that should be processed. + SmallVector<Value *, 64> ValueWorkList; /// BBWorkList - Holds basic blocks that should be processed. SmallVector<BasicBlock *, 64> BBWorkList; @@ -240,7 +240,7 @@ void SparseSolver<LatticeVal>::UpdateState(Instruction &Inst, LatticeVal V) { // An update. Visit uses of I. ValueState[&Inst] = V; - InstWorkList.push_back(&Inst); + ValueWorkList.push_back(&Inst); } template <class LatticeVal> @@ -447,21 +447,20 @@ template <class LatticeVal> void SparseSolver<LatticeVal>::Solve(Function &F) { MarkBlockExecutable(&F.getEntryBlock()); // Process the work lists until they are empty! - while (!BBWorkList.empty() || !InstWorkList.empty()) { - // Process the instruction work list. - while (!InstWorkList.empty()) { - Instruction *I = InstWorkList.back(); - InstWorkList.pop_back(); + while (!BBWorkList.empty() || !ValueWorkList.empty()) { + // Process the value work list. + while (!ValueWorkList.empty()) { + Value *V = ValueWorkList.back(); + ValueWorkList.pop_back(); - DEBUG(dbgs() << "\nPopped off I-WL: " << *I << "\n"); + DEBUG(dbgs() << "\nPopped off V-WL: " << *V << "\n"); - // "I" got into the work list because it made a transition. See if any + // "V" got into the work list because it made a transition. See if any // users are both live and in need of updating. - for (User *U : I->users()) { - Instruction *UI = cast<Instruction>(U); - if (BBExecutable.count(UI->getParent())) // Inst is executable? - visitInst(*UI); - } + for (User *U : V->users()) + if (Instruction *Inst = dyn_cast<Instruction>(U)) + if (BBExecutable.count(Inst->getParent())) // Inst is executable? + visitInst(*Inst); } // Process the basic block work list. |

