llvm-project/llvm/lib
Chen Li 10f01bd4d3 [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

llvm-svn: 244642
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 Fix with a bit more care. (but only a bit) 2015-08-03 20:55:00 +00:00
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 Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC. 2015-06-16 22:27:55 +00:00
LTO Remove access to the DataLayout in the TargetMachine 2015-07-24 16:04:22 +00:00
LibDriver LibDriver: Replace references to lld-link2 with lld-link. 2015-08-06 19:00:42 +00:00
LineEditor Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects. 2015-02-11 03:28:02 +00:00
Linker Linker: Move distinct MDNodes instead of cloning 2015-08-03 17:09:38 +00:00
MC Silence a sign mismatch warning; NFC. 2015-08-10 15:22:39 +00:00
Object Convert getSymbolSection to return an ErrorOr. 2015-08-07 23:27:14 +00:00
Option Add an ArgList::AddAllArgs that accepts a vector of OptSpecifier. 2015-07-29 17:34:41 +00:00
Passes [PM] Fixup for r231556 where I missed a dependency on intrinsics 2015-03-07 09:08:20 +00:00
ProfileData Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
Support Add model numbers for Skylake CPUs and an additional Broadwell model. 2015-08-08 01:29:15 +00:00
TableGen TableGen: Support folding casts from bits to int 2015-07-31 01:12:06 +00:00
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 LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00
LLVMBuild.txt Wrap some long lines in LLVMBuild files. NFC 2015-06-12 18:44:57 +00:00
Makefile LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00