llvm-project/llvm
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
..
autoconf We're actually -Wmissing-field-initializers clean thanks to the cmake 2015-08-07 16:44:47 +00:00
bindings Revert "Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components." 2015-08-05 20:03:26 +00:00
cmake [cmake] Add helper for finding potentially external projects 2015-08-11 17:16:35 +00:00
docs [libFuzzer] fix docs build 2015-08-11 04:16:37 +00:00
examples [PM/AA] Hoist the interface for BasicAA into a header file. 2015-08-06 07:33:15 +00:00
include Revert "Add non-member begin and end so that drop_begin works on iterator_range." 2015-08-11 16:26:06 +00:00
lib [LowerSwitch] Fix a bug when LowerSwitch deletes the default block 2015-08-11 18:12:26 +00:00
projects
resources In MSVC builds embed a VERSIONINFO resource in our exe and DLL files. 2015-06-12 15:58:29 +00:00
test [LowerSwitch] Fix a bug when LowerSwitch deletes the default block 2015-08-11 18:12:26 +00:00
tools [llvm-symbolizer] Remove underscores and other C mangling on Windows 2015-08-10 21:47:11 +00:00
unittests Add SmallString test trying to exercise the realloc() code path 2015-08-11 17:35:49 +00:00
utils Explicitly clear the MI operand list when getInstruction() is called. Call MI.clear() within MCD::OPC_Decode case and inside of translateInstruction() for the X86 target. Remove now unnecessary MI.clear() from ARMDisassembler. 2015-08-11 01:15:07 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore Minor updates to gitignore so that symlinks are ignored in the projects dir. 2015-07-07 20:24:58 +00:00
CMakeLists.txt Revert r244516; it was causing cmake configuration failures on Windows with Visual Studio. 2015-08-11 12:06:04 +00:00
CODE_OWNERS.TXT [WebAssembly] Initial WebAssembly backend 2015-06-29 23:51:55 +00:00
CREDITS.TXT [WebAssembly] Initial WebAssembly backend 2015-06-29 23:51:55 +00:00
LICENSE.TXT
LLVMBuild.txt
Makefile
Makefile.common
Makefile.config.in We're actually -Wmissing-field-initializers clean thanks to the cmake 2015-08-07 16:44:47 +00:00
Makefile.rules We're actually -Wmissing-field-initializers clean thanks to the cmake 2015-08-07 16:44:47 +00:00
README.txt
configure We're actually -Wmissing-field-initializers clean thanks to the cmake 2015-08-07 16:44:47 +00:00
llvm.spec.in [Sparc] Implement i64 load/store support for 32-bit sparc. 2015-08-10 19:11:39 +00:00

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you're writing a package for LLVM, see docs/Packaging.rst for our
suggestions.