aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2017-04-26 16:37:05 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2017-04-26 16:37:05 +0000
commit2cbeb00f3842042accf64fcfc58be6ea3eba42fc (patch)
treec5a2da1f4f0a3ad6e499a9e825380f854601ad32 /llvm/lib/Transforms/IPO/MergeFunctions.cpp
parent9eed0bee3dcda9978ffad6df3e4af1db7d3ffab0 (diff)
downloadllvm-2cbeb00f3842042accf64fcfc58be6ea3eba42fc.zip
llvm-2cbeb00f3842042accf64fcfc58be6ea3eba42fc.tar.gz
llvm-2cbeb00f3842042accf64fcfc58be6ea3eba42fc.tar.bz2
Reverts commit r301424, r301425 and r301426
Commits were: "Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts" "Add a new WeakVH value handle; NFC" "Rename WeakVH to WeakTrackingVH; NFC" The changes assumed pointers are 8 byte aligned on all architectures. llvm-svn: 301429
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/MergeFunctions.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index fbc592f..771770d 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -207,11 +207,11 @@ private:
/// A work queue of functions that may have been modified and should be
/// analyzed again.
- std::vector<WeakTrackingVH> Deferred;
+ std::vector<WeakVH> Deferred;
/// Checks the rules of order relation introduced among functions set.
/// Returns true, if sanity check has been passed, and false if failed.
- bool doSanityCheck(std::vector<WeakTrackingVH> &Worklist);
+ bool doSanityCheck(std::vector<WeakVH> &Worklist);
/// Insert a ComparableFunction into the FnTree, or merge it away if it's
/// equal to one that's already present.
@@ -283,7 +283,7 @@ ModulePass *llvm::createMergeFunctionsPass() {
return new MergeFunctions();
}
-bool MergeFunctions::doSanityCheck(std::vector<WeakTrackingVH> &Worklist) {
+bool MergeFunctions::doSanityCheck(std::vector<WeakVH> &Worklist) {
if (const unsigned Max = NumFunctionsForSanityCheck) {
unsigned TripleNumber = 0;
bool Valid = true;
@@ -291,12 +291,10 @@ bool MergeFunctions::doSanityCheck(std::vector<WeakTrackingVH> &Worklist) {
dbgs() << "MERGEFUNC-SANITY: Started for first " << Max << " functions.\n";
unsigned i = 0;
- for (std::vector<WeakTrackingVH>::iterator I = Worklist.begin(),
- E = Worklist.end();
+ for (std::vector<WeakVH>::iterator I = Worklist.begin(), E = Worklist.end();
I != E && i < Max; ++I, ++i) {
unsigned j = i;
- for (std::vector<WeakTrackingVH>::iterator J = I; J != E && j < Max;
- ++J, ++j) {
+ for (std::vector<WeakVH>::iterator J = I; J != E && j < Max; ++J, ++j) {
Function *F1 = cast<Function>(*I);
Function *F2 = cast<Function>(*J);
int Res1 = FunctionComparator(F1, F2, &GlobalNumbers).compare();
@@ -314,7 +312,7 @@ bool MergeFunctions::doSanityCheck(std::vector<WeakTrackingVH> &Worklist) {
continue;
unsigned k = j;
- for (std::vector<WeakTrackingVH>::iterator K = J; K != E && k < Max;
+ for (std::vector<WeakVH>::iterator K = J; K != E && k < Max;
++k, ++K, ++TripleNumber) {
if (K == J)
continue;
@@ -383,12 +381,12 @@ bool MergeFunctions::runOnModule(Module &M) {
// consider merging it. Otherwise it is dropped and never considered again.
if ((I != S && std::prev(I)->first == I->first) ||
(std::next(I) != IE && std::next(I)->first == I->first) ) {
- Deferred.push_back(WeakTrackingVH(I->second));
+ Deferred.push_back(WeakVH(I->second));
}
}
do {
- std::vector<WeakTrackingVH> Worklist;
+ std::vector<WeakVH> Worklist;
Deferred.swap(Worklist);
DEBUG(doSanityCheck(Worklist));
@@ -397,7 +395,7 @@ bool MergeFunctions::runOnModule(Module &M) {
DEBUG(dbgs() << "size of worklist: " << Worklist.size() << '\n');
// Insert functions and merge them.
- for (WeakTrackingVH &I : Worklist) {
+ for (WeakVH &I : Worklist) {
if (!I)
continue;
Function *F = cast<Function>(I);