]> granicus.if.org Git - llvm/commit
[CodeGenPrepare] Fix crash due to an invalid CFG
authorBrendon Cahoon <bcahoon@codeaurora.org>
Mon, 17 Apr 2017 19:11:04 +0000 (19:11 +0000)
committerBrendon Cahoon <bcahoon@codeaurora.org>
Mon, 17 Apr 2017 19:11:04 +0000 (19:11 +0000)
commit80269962da6b3368009cb0376ee320e71eaf0a5a
tree63c18df4b295a579341c5ab6261ed8f551448b84
parent3778de463505cdc97ea5989e163e6ae5c143b3d6
[CodeGenPrepare] Fix crash due to an invalid CFG

The splitIndirectCriticalEdges function generates and invalid CFG when the
'Target' basic block is a loop to itself. When this occurs, the code that
updates the predecessor terminator needs to update the terminator in the split
basic block.

This occurs when there is an edge from block D back to D. Since D is split in
to D0 and D1, the code needs to update the terminator in D1. But D1 is not in
the OtherPreds vector, so it was not getting updated.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300480 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CodeGenPrepare.cpp
test/Transforms/CodeGenPrepare/split-indirect-loop.ll [new file with mode: 0644]