Skip to content

Commit 192cce1

Browse files
committed
Revert "Recommit "[GlobalOpt] Pass DTU to removeUnreachableBlocks instead 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.
1 parent 92451f0 commit 192cce1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

llvm/lib/Transforms/IPO/GlobalOpt.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -2298,10 +2298,14 @@ OptimizeFunctions(Module &M,
22982298
// So, remove unreachable blocks from the function, because a) there's
22992299
// no point in analyzing them and b) GlobalOpt should otherwise grow
23002300
// some more complicated logic to break these cycles.
2301+
// Removing unreachable blocks might invalidate the dominator so we
2302+
// recalculate it.
23012303
if (!F->isDeclaration()) {
2302-
auto &DT = LookupDomTree(*F);
2303-
DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
2304-
Changed |= removeUnreachableBlocks(*F, &DTU);
2304+
if (removeUnreachableBlocks(*F)) {
2305+
auto &DT = LookupDomTree(*F);
2306+
DT.recalculate(*F);
2307+
Changed = true;
2308+
}
23052309
}
23062310

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

0 commit comments

Comments
 (0)