[NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 5 May 2019 18:59:12 +0000 (18:59 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 5 May 2019 18:59:12 +0000 (18:59 +0000)
commite5be660e25774e4a769be52a9b7817a1917b7ff7
tree3ac1eb093f593dc89a0663d282b1fbe1a052bec7
parent693551d76779822077b57bf5987f7f67a98ca744
[NFC][Utils] deleteDeadLoop(): add an assert that exit block has some non-PHI instruction

Summary:
If `deleteDeadLoop()` is called on such a loop, that has "bad" exit block,
one that e.g. has no terminator instruction, the `DIBuilder::insertDbgValueIntrinsic()`
will be told to insert the Dbg Value Intrinsic after `nullptr`
(since there is no first non-PHI instruction), which will cause it to not insert
those instructions into any basic block. The instructions will be parent-less,
and IR verifier will complain. It is rather obvious to track down the root cause
when that happens, so let's just assert it never happens.

Reviewers: sanjoy, davide, vsk

Reviewed By: vsk

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359993
llvm/lib/Transforms/Utils/LoopUtils.cpp