StructurizeCFG: Fix verification failure with some loops.
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 22 Nov 2013 19:24:39 +0000 (19:24 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 22 Nov 2013 19:24:39 +0000 (19:24 +0000)
commit08e1b756df4bed91621c9a056ace8d8f5b98304c
treec10acf9921382f4916fa539fec4baabc5bfae985
parent7575fdd7a4b5cadc0f0715fd101728b0a8188121
StructurizeCFG: Fix verification failure with some loops.

If the beginning of the loop was also the entry block
of the function, branches were inserted to the entry block
which isn't allowed. If this occurs, create a new dummy
function entry block that branches to the start of the loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195493 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/StructurizeCFG.cpp
test/Transforms/StructurizeCFG/no-branch-to-entry.ll [new file with mode: 0644]