diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2015-02-13 00:29:39 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2015-02-13 00:29:39 +0000 |
| commit | 10a9926ab52b9f2d55e8ad1c7c3451ba397af615 (patch) | |
| tree | 9651d4e8a4e962a0598b81657650b408c3d91cd6 /llvm/lib/Transforms | |
| parent | 24fbdf124bdd8cd1d828efb84b44c96825b7bc90 (diff) | |
| download | bcm5719-llvm-10a9926ab52b9f2d55e8ad1c7c3451ba397af615.tar.gz bcm5719-llvm-10a9926ab52b9f2d55e8ad1c7c3451ba397af615.zip | |
[unroll] Don't use a map from pointer to bool. Use a set.
This is much more efficient. In particular, the query with the user
instruction has to insert a false for every missing instruction into the
set. This is just a cleanup a long the way to fixing the underlying
algorithm problems here.
llvm-svn: 228994
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index a575c457553..feebf1aede9 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -499,12 +499,12 @@ public: unsigned estimateNumberOfDeadInsns() { NumberOfOptimizedInstructions = 0; SmallVector<Instruction *, 8> Worklist; - DenseMap<Instruction *, bool> DeadInstructions; + SmallPtrSet<Instruction *, 16> DeadInstructions; // Start by initializing worklist with simplified instructions. for (auto Folded : SimplifiedValues) { if (auto FoldedInsn = dyn_cast<Instruction>(Folded.first)) { Worklist.push_back(FoldedInsn); - DeadInstructions[FoldedInsn] = true; + DeadInstructions.insert(FoldedInsn); } } // If a definition of an insn is only used by simplified or dead @@ -523,7 +523,7 @@ public: bool AllUsersFolded = true; for (auto U : I->users()) { Instruction *UI = dyn_cast<Instruction>(U); - if (!SimplifiedValues[UI] && !DeadInstructions[UI]) { + if (!SimplifiedValues[UI] && !DeadInstructions.count(UI)) { AllUsersFolded = false; break; } @@ -531,7 +531,7 @@ public: if (AllUsersFolded) { NumberOfOptimizedInstructions += TTI.getUserCost(I); Worklist.push_back(I); - DeadInstructions[I] = true; + DeadInstructions.insert(I); } } } |

