[PATCH] D53089: [LV] Use SmallVector instead of DenseMap in calculateRegisterUsage (NFC).
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 11 02:48:18 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344233: [LV] Use SmallVector instead of DenseMap in calculateRegisterUsage (NFC). (authored by fhahn, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D53089?vs=169033&id=169176#toc
Repository:
rL LLVM
https://reviews.llvm.org/D53089
Files:
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
Index: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4882,19 +4882,18 @@
using IntervalMap = DenseMap<Instruction *, unsigned>;
// Maps instruction to its index.
- DenseMap<unsigned, Instruction *> IdxToInstr;
+ SmallVector<Instruction *, 64> IdxToInstr;
// Marks the end of each interval.
IntervalMap EndPoint;
// Saves the list of instruction indices that are used in the loop.
SmallPtrSet<Instruction *, 8> Ends;
// Saves the list of values that are used in the loop but are
// defined outside the loop, such as arguments and constants.
SmallPtrSet<Value *, 8> LoopInvariants;
- unsigned Index = 0;
for (BasicBlock *BB : make_range(DFS.beginRPO(), DFS.endRPO())) {
for (Instruction &I : BB->instructionsWithoutDebug()) {
- IdxToInstr[Index++] = &I;
+ IdxToInstr.push_back(&I);
// Save the end location of each USE.
for (Value *U : I.operands()) {
@@ -4911,7 +4910,7 @@
}
// Overwrite previous end points.
- EndPoint[Instr] = Index;
+ EndPoint[Instr] = IdxToInstr.size();
Ends.insert(Instr);
}
}
@@ -4948,7 +4947,7 @@
return std::max<unsigned>(1, VF * TypeSize / WidestRegister);
};
- for (unsigned int i = 0; i < Index; ++i) {
+ for (unsigned int i = 0, s = IdxToInstr.size(); i < s; ++i) {
Instruction *I = IdxToInstr[i];
// Remove all of the instructions that end at this location.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53089.169176.patch
Type: text/x-patch
Size: 1630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181011/fdfda6a4/attachment.bin>
More information about the llvm-commits
mailing list