[ADCE] Add code to remove dead branches
authorDavid Callahan <dcallahan@fb.com>
Tue, 13 Dec 2016 16:42:18 +0000 (16:42 +0000)
committerDavid Callahan <dcallahan@fb.com>
Tue, 13 Dec 2016 16:42:18 +0000 (16:42 +0000)
commitebcf916c5aefb82814efeaf6582e31ee149c00f5
tree0e817ba63686fbb6513d486721d3f5515f6d7a9b
parent1647f3855fe517a47704d399a30984004e759e89
[ADCE] Add code to remove dead branches

Summary:
This is last in of a series of patches to evolve ADCE.cpp to support
removing of unnecessary control flow.

This patch adds the code to update the control and data flow graphs
to remove the dead control flow.

Also update unit tests to test the capability to remove dead,
may-be-infinite loop which is enabled by the switch
-adce-remove-loops.

Previous patches:

D23824 [ADCE] Add handling of PHI nodes when removing control flow
D23559 [ADCE] Add control dependence computation
D23225 [ADCE] Modify data structures to support removing control flow
D23065 [ADCE] Refactor anticipating new functionality (NFC)
D23102 [ADCE] Refactoring for new functionality (NFC)

Reviewers: dberlin, majnemer, nadav, mehdi_amini

Subscribers: llvm-commits, david2050, freik, twoh

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

llvm-svn: 289548
18 files changed:
llvm/lib/Transforms/Scalar/ADCE.cpp
llvm/test/Transforms/ADCE/2002-05-23-ZeroArgPHITest.ll
llvm/test/Transforms/ADCE/2002-05-28-Crash-distilled.ll
llvm/test/Transforms/ADCE/2002-05-28-Crash.ll
llvm/test/Transforms/ADCE/2002-07-17-AssertionFailure.ll
llvm/test/Transforms/ADCE/2002-07-17-PHIAssertion.ll
llvm/test/Transforms/ADCE/2002-07-29-Segfault.ll
llvm/test/Transforms/ADCE/2003-01-22-PredecessorProblem.ll
llvm/test/Transforms/ADCE/2003-04-25-PHIPostDominateProblem.ll
llvm/test/Transforms/ADCE/2003-06-11-InvalidCFG.ll
llvm/test/Transforms/ADCE/2003-06-24-BadSuccessor.ll
llvm/test/Transforms/ADCE/2003-06-24-BasicFunctionality.ll
llvm/test/Transforms/ADCE/2003-09-15-InfLoopCrash.ll
llvm/test/Transforms/ADCE/2003-11-16-MissingPostDominanceInfo.ll
llvm/test/Transforms/ADCE/2004-05-04-UnreachableBlock.ll
llvm/test/Transforms/ADCE/2016-09-06.ll [new file with mode: 0644]
llvm/test/Transforms/ADCE/basictest1.ll
llvm/test/Transforms/ADCE/basictest2.ll