Mercurial > hg > CbC > CbC_llvm
diff lib/Transforms/IPO/MergeFunctions.cpp @ 83:60c9769439b8 LLVM3.7
LLVM 3.7
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 18 Feb 2015 14:55:36 +0900 |
parents | 54457678186b |
children | 5e5d649e25d2 afa8332a0e37 |
line wrap: on
line diff
--- a/lib/Transforms/IPO/MergeFunctions.cpp Mon Sep 08 22:07:30 2014 +0900 +++ b/lib/Transforms/IPO/MergeFunctions.cpp Wed Feb 18 14:55:36 2015 +0900 @@ -392,15 +392,15 @@ DenseMap<const Value*, int> sn_mapL, sn_mapR; }; -class FunctionPtr { +class FunctionNode { AssertingVH<Function> F; const DataLayout *DL; public: - FunctionPtr(Function *F, const DataLayout *DL) : F(F), DL(DL) {} + FunctionNode(Function *F, const DataLayout *DL) : F(F), DL(DL) {} Function *getFunc() const { return F; } void release() { F = 0; } - bool operator<(const FunctionPtr &RHS) const { + bool operator<(const FunctionNode &RHS) const { return (FunctionComparator(DL, F, RHS.getFunc()).compare()) == -1; } }; @@ -1049,7 +1049,7 @@ assert(TermL->getNumSuccessors() == TermR->getNumSuccessors()); for (unsigned i = 0, e = TermL->getNumSuccessors(); i != e; ++i) { - if (!VisitedBBs.insert(TermL->getSuccessor(i))) + if (!VisitedBBs.insert(TermL->getSuccessor(i)).second) continue; FnLBBs.push_back(TermL->getSuccessor(i)); @@ -1077,7 +1077,7 @@ bool runOnModule(Module &M) override; private: - typedef std::set<FunctionPtr> FnTreeType; + typedef std::set<FunctionNode> FnTreeType; /// A work queue of functions that may have been modified and should be /// analyzed again. @@ -1420,14 +1420,14 @@ // that was already inserted. bool MergeFunctions::insert(Function *NewFunction) { std::pair<FnTreeType::iterator, bool> Result = - FnTree.insert(FunctionPtr(NewFunction, DL)); + FnTree.insert(FunctionNode(NewFunction, DL)); if (Result.second) { DEBUG(dbgs() << "Inserting as unique: " << NewFunction->getName() << '\n'); return false; } - const FunctionPtr &OldF = *Result.first; + const FunctionNode &OldF = *Result.first; // Don't merge tiny functions, since it can just end up making the function // larger. @@ -1457,7 +1457,7 @@ void MergeFunctions::remove(Function *F) { // We need to make sure we remove F, not a function "equal" to F per the // function equality comparator. - FnTreeType::iterator found = FnTree.find(FunctionPtr(F, DL)); + FnTreeType::iterator found = FnTree.find(FunctionNode(F, DL)); size_t Erased = 0; if (found != FnTree.end() && found->getFunc() == F) { Erased = 1;