llvm/lib
Chen Li a0180252f1 [LowerSwitch] Fix a bug when LowerSwitch deletes the default block
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244642 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-11 18:12:26 +00:00
..
Analysis Add support for floating-point minnum and maxnum 2015-08-11 09:12:57 +00:00
AsmParser
Bitcode Rangify for loop, NFC. 2015-08-10 07:04:29 +00:00
CodeGen fix minsize detection: minsize attribute implies optimizing for size 2015-08-11 17:04:31 +00:00
DebugInfo Fix some comment typos. 2015-08-08 18:27:36 +00:00
ExecutionEngine [RuntimeDyld][AArch64] Add explicit addends before calling relocationValueRef. 2015-08-11 06:27:53 +00:00
Fuzzer Fix unused variable 'X' in release builds. 2015-08-11 05:57:10 +00:00
IR [IR] Verify EH pad predecessors 2015-08-11 02:48:30 +00:00
IRReader
LibDriver
LineEditor
Linker
LTO
MC Silence a sign mismatch warning; NFC. 2015-08-10 15:22:39 +00:00
Object
Option
Passes
ProfileData
Support Add model numbers for Skylake CPUs and an additional Broadwell model. 2015-08-08 01:29:15 +00:00
TableGen
Target Use llvm::make_unique to fix the MSVC build. 2015-08-11 18:11:17 +00:00
Transforms [LowerSwitch] Fix a bug when LowerSwitch deletes the default block 2015-08-11 18:12:26 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile