]> granicus.if.org Git - llvm/commit
[IfConversion] Keep the CFG updated incrementally in IfConvertTriangle
authorMikael Holmen <mikael.holmen@ericsson.com>
Fri, 12 May 2017 06:28:58 +0000 (06:28 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Fri, 12 May 2017 06:28:58 +0000 (06:28 +0000)
commite43c10d2019850118e3f6aec5438343f053991ce
tree18f709db62be75592a29ed4275e76850ef100ecb
parent1dfa6e7374f471292610e450cef2de76d466b523
[IfConversion] Keep the CFG updated incrementally in IfConvertTriangle

Summary:
Instead of using RemoveExtraEdges (which uses analyzeBranch, which cannot
always be trusted) at the end to fixup the CFG we keep the CFG updated as
we go along and remove or add branches and merge blocks.

This way we won't have any problems if the involved MBBs contain
unanalyzable instructions.

This fixes PR32721.

In that case we had a triangle

   EBB
   | \
   |  |
   | TBB
   |  /
   FBB

where FBB didn't have any successors at all since it ended with an
unconditional return. Then TBB and FBB were be merged into EBB, but EBB
would still keep its successors, and the use of analyzeBranch and
CorrectExtraCFGEdges wouldn't help to remove them since the return
instruction is not analyzable (at least not on ARM).

Reviewers: kparzysz, iteratee, MatzeB

Reviewed By: iteratee

Subscribers: aemerson, rengolin, javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302876 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/IfConversion.cpp
test/CodeGen/MIR/ARM/PR32721_ifcvt_triangle_unanalyzable.mir [new file with mode: 0644]