[PATCH] D58045: [IndVars] Fix corner case with unreachable Phi inputs. PR40454

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 11 04:04:47 PST 2019


mkazantsev created this revision.
mkazantsev added reviewers: cszide, spatel, andreadb, sanjoy, skatkov.

Logic in `getInsertPointForUses` doesn't account for a corner case when `Def` only
comes to a Phi user from unreachable blocks. In this case, the incoming value may
be arbitrary (and not even available in the input block) and break the loop-related
invariants that are asserted below.

In fact, if we encounter this situation, no IR modification is needed. This Phi will be
simplified away with nearest cleanup.


https://reviews.llvm.org/D58045

Files:
  lib/Transforms/Scalar/IndVarSimplify.cpp
  test/Transforms/IndVarSimplify/pr40454.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58045.186229.patch
Type: text/x-patch
Size: 4006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190211/50b6c410/attachment.bin>


More information about the llvm-commits mailing list