[PATCH] D34516: [LoopDeletion] Update exits correctly when multiple duplicate edges from an exiting block

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 09:27:47 PDT 2017


anna created this revision.
Herald added a subscriber: mzolotukhin.

Currently, we incorrectly update exit blocks of loops when there are multiple
edges from a single exiting block to the exit block. This can happen when we
have switches as the terminator of the exiting blocks.
The fix here is to correctly update the phi nodes in the exit block, and remove
all incoming values *except* for one which is from the preheader.

Note: Currently, this error can manifest only while deleting non-executed loops. However, it
is possible to trigger this error in invariant loops, once we enhance the logic
around the exit conditions for the loop check.


https://reviews.llvm.org/D34516

Files:
  lib/Transforms/Scalar/LoopDeletion.cpp
  test/Transforms/LoopDeletion/unreachable-loops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34516.103586.patch
Type: text/x-patch
Size: 5078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170622/c8507d55/attachment.bin>


More information about the llvm-commits mailing list