diff options
Diffstat (limited to 'lib/Transforms/Utils/SplitModule.cpp')
| -rw-r--r-- | lib/Transforms/Utils/SplitModule.cpp | 28 | 
1 files changed, 16 insertions, 12 deletions
| diff --git a/lib/Transforms/Utils/SplitModule.cpp b/lib/Transforms/Utils/SplitModule.cpp index 968eb0208f43..f8d758c54983 100644 --- a/lib/Transforms/Utils/SplitModule.cpp +++ b/lib/Transforms/Utils/SplitModule.cpp @@ -101,7 +101,8 @@ static void findPartitions(Module *M, ClusterIDMapType &ClusterIDMap,    // At this point module should have the proper mix of globals and locals.    // As we attempt to partition this module, we must not change any    // locals to globals. -  DEBUG(dbgs() << "Partition module with (" << M->size() << ")functions\n"); +  LLVM_DEBUG(dbgs() << "Partition module with (" << M->size() +                    << ")functions\n");    ClusterMapType GVtoClusterMap;    ComdatMembersType ComdatMembers; @@ -180,28 +181,31 @@ static void findPartitions(Module *M, ClusterIDMapType &ClusterIDMap,            std::make_pair(std::distance(GVtoClusterMap.member_begin(I),                                         GVtoClusterMap.member_end()), I)); -  std::sort(Sets.begin(), Sets.end(), [](const SortType &a, const SortType &b) { -    if (a.first == b.first) -      return a.second->getData()->getName() > b.second->getData()->getName(); -    else -      return a.first > b.first; -  }); +  llvm::sort(Sets.begin(), Sets.end(), +             [](const SortType &a, const SortType &b) { +               if (a.first == b.first) +                 return a.second->getData()->getName() > +                        b.second->getData()->getName(); +               else +                 return a.first > b.first; +             });    for (auto &I : Sets) {      unsigned CurrentClusterID = BalancinQueue.top().first;      unsigned CurrentClusterSize = BalancinQueue.top().second;      BalancinQueue.pop(); -    DEBUG(dbgs() << "Root[" << CurrentClusterID << "] cluster_size(" << I.first -                 << ") ----> " << I.second->getData()->getName() << "\n"); +    LLVM_DEBUG(dbgs() << "Root[" << CurrentClusterID << "] cluster_size(" +                      << I.first << ") ----> " << I.second->getData()->getName() +                      << "\n");      for (ClusterMapType::member_iterator MI =               GVtoClusterMap.findLeader(I.second);           MI != GVtoClusterMap.member_end(); ++MI) {        if (!Visited.insert(*MI).second)          continue; -      DEBUG(dbgs() << "----> " << (*MI)->getName() -                   << ((*MI)->hasLocalLinkage() ? " l " : " e ") << "\n"); +      LLVM_DEBUG(dbgs() << "----> " << (*MI)->getName() +                        << ((*MI)->hasLocalLinkage() ? " l " : " e ") << "\n");        Visited.insert(*MI);        ClusterIDMap[*MI] = CurrentClusterID;        CurrentClusterSize++; @@ -270,7 +274,7 @@ void llvm::SplitModule(    for (unsigned I = 0; I < N; ++I) {      ValueToValueMapTy VMap;      std::unique_ptr<Module> MPart( -        CloneModule(M.get(), VMap, [&](const GlobalValue *GV) { +        CloneModule(*M, VMap, [&](const GlobalValue *GV) {            if (ClusterIDMap.count(GV))              return (ClusterIDMap[GV] == I);            else | 
