[PATCH] D56362: [DemandedBits] Use SetVector for Worklist
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 7 10:07:18 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350547: [DemandedBits] Use SetVector for Worklist (authored by nikic, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D56362?vs=180402&id=180517#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56362/new/
https://reviews.llvm.org/D56362
Files:
llvm/trunk/lib/Analysis/DemandedBits.cpp
Index: llvm/trunk/lib/Analysis/DemandedBits.cpp
===================================================================
--- llvm/trunk/lib/Analysis/DemandedBits.cpp
+++ llvm/trunk/lib/Analysis/DemandedBits.cpp
@@ -21,8 +21,7 @@
#include "llvm/Analysis/DemandedBits.h"
#include "llvm/ADT/APInt.h"
-#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/ValueTracking.h"
@@ -315,7 +314,7 @@
AliveBits.clear();
DeadUses.clear();
- SmallVector<Instruction*, 128> Worklist;
+ SmallSetVector<Instruction*, 128> Worklist;
// Collect the set of "root" instructions that are known live.
for (Instruction &I : instructions(F)) {
@@ -330,7 +329,7 @@
Type *T = I.getType();
if (T->isIntOrIntVectorTy()) {
if (AliveBits.try_emplace(&I, T->getScalarSizeInBits(), 0).second)
- Worklist.push_back(&I);
+ Worklist.insert(&I);
continue;
}
@@ -341,7 +340,7 @@
Type *T = J->getType();
if (T->isIntOrIntVectorTy())
AliveBits[J] = APInt::getAllOnesValue(T->getScalarSizeInBits());
- Worklist.push_back(J);
+ Worklist.insert(J);
}
}
// To save memory, we don't add I to the Visited set here. Instead, we
@@ -412,11 +411,11 @@
APInt ABNew = AB | ABPrev;
if (ABNew != ABPrev || ABI == AliveBits.end()) {
AliveBits[I] = std::move(ABNew);
- Worklist.push_back(I);
+ Worklist.insert(I);
}
}
} else if (I && !Visited.count(I)) {
- Worklist.push_back(I);
+ Worklist.insert(I);
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56362.180517.patch
Type: text/x-patch
Size: 1741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190107/2c694e5f/attachment.bin>
More information about the llvm-commits
mailing list