[all-commits] [llvm/llvm-project] c22bc5: [SimplifyCFG] SwitchToLookupTable(): don't insert ...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Mon Jan 11 15:10:23 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c22bc5f1f8b295674aa3a62dced8a39ad3d2aa02
      https://github.com/llvm/llvm-project/commit/c22bc5f1f8b295674aa3a62dced8a39ad3d2aa02
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [SimplifyCFG] SwitchToLookupTable(): don't insert a DomTree edge that already exists

SI is the terminator of BB, so the edge we are adding obviously already existed.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.


  Commit: c0de0a1b72c08783141c430b583e04e5107ebc0a
      https://github.com/llvm/llvm-project/commit/c0de0a1b72c08783141c430b583e04e5107ebc0a
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [SimplifyCFG] SimplifyBranchOnICmpChain(): don't insert a DomTree edge that already exists

BB was already always branching to EdgeBB, there is no edge to add.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.


  Commit: f9ba34770638389ee9b251f6ab801c7411601c77
      https://github.com/llvm/llvm-project/commit/f9ba34770638389ee9b251f6ab801c7411601c77
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [SimplifyCFG] FoldValueComparisonIntoPredecessors(): don't insert a DomTree edge if it already exists

When we are adding edges to the terminator and potentially turning it
into a switch (if it wasn't already), it is possible that the
case we're adding will share it's destination with one of the
preexisting cases, in which case there is no domtree edge to add.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.


  Commit: 90a92f8b4d783cb08443a22f0dd2fa3adcb43807
      https://github.com/llvm/llvm-project/commit/90a92f8b4d783cb08443a22f0dd2fa3adcb43807
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/Local.cpp

  Log Message:
  -----------
  [NFCI][Utils/Local] removeUnreachableBlocks(): cleanup support for lazy DomTreeUpdater

When DomTreeUpdater is in lazy update mode, the blocks
that were scheduled to be removed, won't be removed
until the updates are flushed, e.g. by asking
DomTreeUpdater for a up-to-date DomTree.

>From the function's current code, it is pretty evident
that the support for the lazy mode is an afterthought,
see e.g. how we roll-back NumRemoved statistic..

So instead of considering all the unreachable blocks
as the blocks-to-be-removed, simply additionally skip
all the blocks that are already scheduled to be removed


  Commit: 81afeacd379f160495718438d6dd5e9b848a169d
      https://github.com/llvm/llvm-project/commit/81afeacd379f160495718438d6dd5e9b848a169d
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp

  Log Message:
  -----------
  [SimplifyCFGPass] mergeEmptyReturnBlocks(): skip blocks scheduled for removal as per DomTreeUpdater

Thus supporting lazy DomTreeUpdater mode,
where the domtree updates (and thus block removals)
aren't applied immediately, but are delayed
until last possible moment.


  Commit: ec8a6c11db4102ec249ce90084b3f615c5de15e5
      https://github.com/llvm/llvm-project/commit/ec8a6c11db4102ec249ce90084b3f615c5de15e5
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-12 (Tue, 12 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp

  Log Message:
  -----------
  [SimplifyCFGPass] iterativelySimplifyCFG(): support lazy DomTreeUpdater

This boils down to how we deal with early-increment iterator
over function's basic blocks: not only we need to early-increment,
after that we also need to skip all the blocks
that are scheduled for removal, as per DomTreeUpdater.


Compare: https://github.com/llvm/llvm-project/compare/278a3ea1b270...ec8a6c11db41


More information about the All-commits mailing list