File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2285,10 +2285,14 @@ OptimizeFunctions(Module &M,
2285
2285
// So, remove unreachable blocks from the function, because a) there's
2286
2286
// no point in analyzing them and b) GlobalOpt should otherwise grow
2287
2287
// some more complicated logic to break these cycles.
2288
+ // Removing unreachable blocks might invalidate the dominator so we
2289
+ // recalculate it.
2288
2290
if (!F->isDeclaration ()) {
2289
- auto &DT = LookupDomTree (*F);
2290
- DomTreeUpdater DTU (DT, DomTreeUpdater::UpdateStrategy::Lazy);
2291
- Changed |= removeUnreachableBlocks (*F, nullptr , &DTU);
2291
+ if (removeUnreachableBlocks (*F)) {
2292
+ auto &DT = LookupDomTree (*F);
2293
+ DT.recalculate (*F);
2294
+ Changed = true ;
2295
+ }
2292
2296
}
2293
2297
2294
2298
Changed |= processGlobal (*F, GetTLI, LookupDomTree);
You can’t perform that action at this time.
0 commit comments