This is an archive of the discontinued LLVM Phabricator instance.

[Dominators] Refine the logic of recalculate() in the DomTreeUpdater
ClosedPublic

Authored by NutshellySima on Aug 2 2018, 2:17 AM.

Details

Summary

This patch refines the logic of recalculate() in the DomTreeUpdater in the following two aspects:

  1. Previously, recalculate() tests whether there are pending updates/BBs awaiting deletion and then do recalculation under Lazy UpdateStrategy; and do recalculation immediately under Eager UpdateStrategy. (The former behavior is inherited from the DeferredDominance class). This is an inconsistency between two strategies and there is no obvious reason to do this. So the behavior is changed to always recalculate available trees when calling recalculate().
  2. Fix the issue of when DTU under Lazy UpdateStrategy holds nothing but with BBs awaiting deletion, after calling recalculate(), BBs awaiting deletion aren't flushed. An additional unittest is added to cover this case.

Diff Detail

Repository
rL LLVM

Event Timeline

NutshellySima created this revision.Aug 2 2018, 2:17 AM
kuhar accepted this revision.Aug 2 2018, 9:01 AM

Looks good, thanks for the patch!

include/llvm/IR/DomTreeUpdater.h
164 ↗(On Diff #158705)

I like this comment, it's brief but straight to the point!

This revision is now accepted and ready to land.Aug 2 2018, 9:01 AM
This revision was automatically updated to reflect the committed changes.