Commit f33d66fe authored by Tanya Lattner's avatar Tanya Lattner
Browse files

Merging from mainline.

llvm-svn: 31611
parent bad3d39a
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -112,8 +112,13 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
        // Calls to external functions are never inlinable.
        if (Callee->isExternal() ||
            CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){
          if (SCC.size() == 1) {
            std::swap(CallSites[CSi], CallSites.back());
            CallSites.pop_back();
          } else {
            // Keep the 'in SCC / not in SCC' boundary correct.
            CallSites.erase(CallSites.begin()+CSi);
          }
          --CSi;
          continue;
        }
@@ -131,9 +136,16 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {

          // Attempt to inline the function...
          if (InlineCallIfPossible(CS, CG, SCCFunctions)) {
            // Remove this call site from the list.
            // Remove this call site from the list.  If possible, use 
            // swap/pop_back for efficiency, but do not use it if doing so would
            // move a call site to a function in this SCC before the
            // 'FirstCallInSCC' barrier.
            if (SCC.size() == 1) {
              std::swap(CallSites[CSi], CallSites.back());
              CallSites.pop_back();
            } else {
              CallSites.erase(CallSites.begin()+CSi);
            }
            --CSi;

            ++NumInlined;