[PATCH] D48967: [Dominators] Convert existing passes and utils to use the DomTreeUpdater class

Chijun Sima via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 25 11:19:33 PDT 2018


NutshellySima added a comment.

The patch converts passes and utils as the following
A. Pass Convertions

  Eager (It's functionally equivalent)
  DT/PDT.insertEdge/deleteEdge/applyUpdates -> DTU.insertEdge/deleteEdge/applyUpdates
  Lazy
  DDT.applyUpdates -> DTU.applyUpdates (because pass can control the UpdateStrategy it uses)
  DDT.insert/deleteEdge -> DTU.insert/deleteEdgeRelaxed
  DDT.pendingDeletedBB -> DTU.isBBPendingDeletion
  DDT.flush -> DTU.getDomTree (DTU will auto-flush on destruction)
  DDT.deleteBB -> DTU.deleteBB

B. Util Transforms
Despite transforms above,
a. `DDT.applyUpdates` is replaced with `DTU.applyUpdates(..., /*ForceRemoveDuplicates*/ true)` to make Eager Strategy DTU passed into can also do deduplication like DDT does.
b.

  DDT.deleteBB(...);
  DDT.applyUpdates(...);

is replaced with

  ... // Make sure the successor list of BB is cleared!
  DTU.applyUpdates(..., /*ForceRemoveDuplicates*/ true);
  DTU.deleteBB(BB);

c. Eager Strategy recalculation

  DDT.deleteBB(BB);
  DDT.recalculate(F);

is replaced with

  DTU.deleteBB(BB, /*DisableNodeErasing*/)
  DTU.recalculate(F);

d. All code not using the incremental update method is removed.
C. Unittest

1. Modify the unittest to check MergeBasicBlockIntoOnlyPred in Local.cpp (12 [2*3*2] patterns)

  UpdateStrategy
  a. Eager UpdateStrategy
  b. Lazy UpdateStrategy
  DT/PDT
  a. only DT
  b. only PDT
  c. DT+PDT
  IR
  a. replace the Entry BB
  b. does not replace entry BB

2. Modify the unittest for ConstantFoldTerminator to test both DT and PDT under Eager/Lazy UpdateStrategy.
3. Add a unittest for RemoveUnreachableBlocks to test DT and PDT under Eager/Lazy UpdateStrategy


https://reviews.llvm.org/D48967





More information about the llvm-commits mailing list