]> granicus.if.org Git - llvm/commit
[SimplifyCFG] Cleanup redundant conditions [NFC].
authorAlina Sbirlea <asbirlea@google.com>
Fri, 2 Aug 2019 18:06:54 +0000 (18:06 +0000)
committerAlina Sbirlea <asbirlea@google.com>
Fri, 2 Aug 2019 18:06:54 +0000 (18:06 +0000)
commitb3b80fb7cca62a22562e53225a5acbb4f2ee5c31
tree5d893002100ca11e8a1fe2fc36a481d053ae7c89
parente1704f3ec88cc2285ba65376d0487a18aaa7efb4
[SimplifyCFG] Cleanup redundant conditions [NFC].

Summary:
Since the for loop iterates over BB's predecessors, the branch conditions found must have BB as one of the successors.
For an unconditional branch the successor must be BB, added `assert`.
For a conditional branch, one of the two successors must be BB, simplify `else if` to `else` and `assert`.
Sink common instructions outside the if/else block.

Reviewers: sanjoy.google

Subscribers: jlebar, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367699 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp