]> granicus.if.org Git - llvm/commit
[Dominators] Teach LoopDeletion to use the new incremental API
authorJakub Kuderski <kubakuderski@gmail.com>
Wed, 2 Aug 2017 18:17:52 +0000 (18:17 +0000)
committerJakub Kuderski <kubakuderski@gmail.com>
Wed, 2 Aug 2017 18:17:52 +0000 (18:17 +0000)
commit95e74fa2386e9bb65487ed59dca484f47ae20623
tree9fd93be25aebd4f3ac4192d40b82df0fb1821988
parentf49a98121171ab1ff88228fa41c02c6c9dfc4953
[Dominators] Teach LoopDeletion to use the new incremental API

Summary:
This patch makes LoopDeletion use the incremental DominatorTree API.

We modify LoopDeletion to perform the deletion in 5 steps:
1. Create a new dummy edge from the preheader to the exit, by adding a conditional branch.
2. Inform the DomTree about the new edge.
3. Remove the conditional branch and replace it with an unconditional edge to the exit. This removes the edge to the loop header, making it unreachable.
4. Inform the DomTree about the deleted edge.
5. Remove the unreachable block from the function.

Creating the dummy conditional branch is necessary to perform incremental DomTree update.
We should consider using the batch updater when it's ready.

Reviewers: dberlin, davide, grosser, sanjoy

Reviewed By: dberlin, grosser

Subscribers: mzolotukhin, llvm-commits

Differential Revision: https://reviews.llvm.org/D35391

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309850 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/GenericDomTree.h
lib/Transforms/Scalar/LoopDeletion.cpp
test/Transforms/LoopDeletion/2017-07-11-incremental-dt.ll [new file with mode: 0644]
unittests/IR/DominatorTreeTest.cpp