forked from OSchip/llvm-project
10f01bd4d3
Summary: LowerSwitch crashed with the attached test case after deleting the default block. This happened because the current implementation of deleting dead blocks is wrong. After the default block being deleted, it contains no instruction or terminator, and it should no be traversed anymore. However, since the iterator is advanced before processSwitchInst() function is executed, the block advanced to could be deleted inside processSwitchInst(). The deleted block would then be visited next and crash dyn_cast<SwitchInst>(Cur->getTerminator()) because Cur->getTerminator() returns a nullptr. This patch fixes this problem by recording dead default blocks into a list, and delete them after all processSwitchInst() has been done. It still possible to visit dead default blocks and waste time process them. But it is a compile time issue, and I plan to have another patch to add support to skip dead blocks. Reviewers: kariddi, resistor, hans, reames Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11852 llvm-svn: 244642 |
||
---|---|---|
.. | ||
2003-05-01-PHIProblem.ll | ||
2003-08-23-EmptySwitch.ll | ||
2004-03-13-SwitchIsDefaultCrash.ll | ||
2014-06-10-SwitchContiguousOpt.ll | ||
2014-06-11-SwitchDefaultUnreachableOpt.ll | ||
2014-06-23-PHIlowering.ll | ||
delete-default-block-crash.ll | ||
feature.ll | ||
fold-popular-case-to-unreachable-default.ll |