[llvm] r330398 - [SSAUpdaterBulk] Use SmallVector instead of SmallPtrSet for uses.
Michael Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 20 00:56:01 PDT 2018
Author: mzolotukhin
Date: Fri Apr 20 00:56:00 2018
New Revision: 330398
URL: http://llvm.org/viewvc/llvm-project?rev=330398&view=rev
Log:
[SSAUpdaterBulk] Use SmallVector instead of SmallPtrSet for uses.
Modified:
llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterBulk.h
llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp
Modified: llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterBulk.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterBulk.h?rev=330398&r1=330397&r2=330398&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterBulk.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterBulk.h Fri Apr 20 00:56:00 2018
@@ -41,7 +41,7 @@ class DominatorTree;
class SSAUpdaterBulk {
struct RewriteInfo {
DenseMap<BasicBlock *, Value *> Defines;
- SmallPtrSet<Use *, 4> Uses;
+ SmallVector<Use *, 4> Uses;
StringRef Name;
Type *Ty;
RewriteInfo(){};
Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp?rev=330398&r1=330397&r2=330398&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp Fri Apr 20 00:56:00 2018
@@ -61,7 +61,7 @@ void SSAUpdaterBulk::AddUse(unsigned Var
assert(Rewrites.find(Var) != Rewrites.end() && "Should add variable first!");
DEBUG(dbgs() << "SSAUpdater: Var=" << Var << ": added a use" << *U->get()
<< " in " << getUserBB(U)->getName() << "\n");
- Rewrites[Var].Uses.insert(U);
+ Rewrites[Var].Uses.push_back(U);
}
/// Return true if the SSAUpdater already has a value for the specified variable
@@ -171,7 +171,10 @@ void SSAUpdaterBulk::RewriteAllUses(Domi
}
// Rewrite actual uses with the inserted definitions.
- for (auto U : R.Uses) {
+ SmallPtrSet<Use *, 4> ProcessedUses;
+ for (Use *U : R.Uses) {
+ if (!ProcessedUses.insert(U).second)
+ continue;
Value *V = computeValueAt(getUserBB(U), R, DT);
Value *OldVal = U->get();
// Notify that users of the existing value that it is being replaced.
More information about the llvm-commits
mailing list