Skip to content

Commit

Permalink
Revert "Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks ins…
Browse files Browse the repository at this point in the history
…tead of recomputing.""

This reverts commit a03d7b0.

As discussed in D68298, this causes a compile-time regression, in case
the DTs requested are not used elsewhere in GlobalOpt. We should only
get the DTs if they are available here, but this seems not possible with
the legacy pass manager from a module pass.
  • Loading branch information
fhahn committed Jan 14, 2020
1 parent 92451f0 commit 192cce1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions llvm/lib/Transforms/IPO/GlobalOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2298,10 +2298,14 @@ 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()) {
auto &DT = LookupDomTree(*F);
DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
Changed |= removeUnreachableBlocks(*F, &DTU);
if (removeUnreachableBlocks(*F)) {
auto &DT = LookupDomTree(*F);
DT.recalculate(*F);
Changed = true;
}
}

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

0 comments on commit 192cce1

Please sign in to comment.