Commit a03d7b0f authored by Florian Hahn's avatar Florian Hahn
Browse files

Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead of recomputing."

The cause for the revert should be fixed by r373513 /
a80b6c15

This reverts commit 47dbcbd8.

llvm-svn: 373522
parent 5a8b229c
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -2285,14 +2285,10 @@ OptimizeFunctions(Module &M,
    // So, remove unreachable blocks from the function, because a) there's
    // no point in analyzing them and b) GlobalOpt should otherwise grow
    // some more complicated logic to break these cycles.
    // Removing unreachable blocks might invalidate the dominator so we
    // recalculate it.
    if (!F->isDeclaration()) {
      if (removeUnreachableBlocks(*F)) {
      auto &DT = LookupDomTree(*F);
        DT.recalculate(*F);
        Changed = true;
      }
      DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
      Changed |= removeUnreachableBlocks(*F, &DTU);
    }

    Changed |= processGlobal(*F, GetTLI, LookupDomTree);