[PATCH] D58170: [DTU] Refine the logic of deduplication

Chijun Sima via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 03:43:31 PST 2019

NutshellySima created this revision.
NutshellySima added reviewers: kuhar, brzycki, dmgreen, grosser.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

The deduplication logic of the DomTree updater needs to handle the following things:

1. remove updates that never happen (validity checking)
2. remove duplicates

Previously, DTU does validity checking before deduplication, which can cause updates that have already been applied to be submitted again. 
The following example demonstrates a bug caused by this:

  0. DTU(Lazy) and Edge A->B exists.
  1. Remove A->B
  2. Add back A->B
  3. DTU.applyUpdates({{Delete, A, B}, {Insert, A, B}})
  Validity checking leaves {Insert, A, B} which is then pending to be applied. (Bug1: DT sometimes asserts on updates that have already been applied)
  4. Remove A->B
  5. DTU.applyUpdates({{Delete, A, B}})
  DTU cancels this update with {Insert, A, B} mentioned above together. (Bug2: {Delete, A, B} should be applied)

But by considering the precondition that updates cannot be submitted again to DTU once they have been applied, we can safely infer whether an edge exists before by inspecting the first update on this edge submitted to DTU.
If the first update to an edge is "Delete", it means that the edge existed before. If the first update to an edge is "Insert", it means that the edge didn't exist before.

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58170.186620.patch
Type: text/x-patch
Size: 5361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190213/1df5f314/attachment.bin>

More information about the llvm-commits mailing list