[PATCH] D81582: [BreakCritEdges] Check if we need to split blocks with indirectbr terms.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 09:17:48 PDT 2020


fhahn created this revision.
fhahn added reviewers: reames, hfinkel, davide, efriedma.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

If the critical edge we are splitting goes from a block inside a loop to
a block outside the loop, splitting the edge will create a new exit
block. As a result, the new block will branch to the original exit
block, which will add a non-loop predecessor, breaking loop-simplify
form. To preserve loop-simplify form, the predecessor blocks of the
original exit are split, but that does not work for blocks with
indirectbr terminators. Bail out in that case, before making any
changes.

On MultiSource, SPEC2000 & SPEC2006, there are no binary changes with
this patch.

This fixes a crash exposed by 189efe295b6e.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81582

Files:
  llvm/lib/Transforms/Scalar/GVN.cpp
  llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
  llvm/test/Transforms/GVN/critical-edge-split-indbr-pred-in-loop.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81582.269875.patch
Type: text/x-patch
Size: 6119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200610/2b4a6641/attachment.bin>


More information about the llvm-commits mailing list