[PATCH] D33037: [IfConversion] Keep the CFG updated incrementally in IfConvertTriangle

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 06:22:03 PDT 2017


uabelho created this revision.
Herald added subscribers: javed.absar, rengolin, aemerson.

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).


https://reviews.llvm.org/D33037

Files:
  lib/CodeGen/IfConversion.cpp
  test/CodeGen/MIR/ARM/PR32721_ifcvt_triangle_unanalyzable.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33037.98430.patch
Type: text/x-patch
Size: 3582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170510/bb433099/attachment.bin>


More information about the llvm-commits mailing list