OSDN Git Service

[SimplifyCFG] Don't kill empty cleanuppads with multiple uses
authorDavid Majnemer <david.majnemer@gmail.com>
Sat, 4 Jun 2016 23:50:03 +0000 (23:50 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sat, 4 Jun 2016 23:50:03 +0000 (23:50 +0000)
commit8c4b6172035bb0b4424fe92654336b5aa3b89f4a
tree6f12f50e9926f85a8fded0a25a38e8294f72b9c5
parentc6b77e5c06c2024c2b0bc3e589d0babcd2c76e4e
[SimplifyCFG] Don't kill empty cleanuppads with multiple uses

A basic block could contain:
  %cp = cleanuppad []
  cleanupret from %cp unwind to caller

This basic block is empty and is thus a candidate for removal.  However,
there can be other uses of %cp outside of this basic block.  This is
only possible in unreachable blocks.

Make our transform more correct by checking that the pad has a single
user before removing the BB.

This fixes PR28005.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271816 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/empty-cleanuppad.ll