1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 22:42:46 +02:00
llvm-mirror/lib/Transforms
Chen Li 13db1247c9 [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
..
Hello Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
InstCombine Add support for floating-point minnum and maxnum 2015-08-11 09:12:57 +00:00
Instrumentation [libFuzzer] don't crash if the condition in a switch has unusual type (e.g. i72) 2015-08-11 00:24:39 +00:00
IPO Enable EliminateAvailableExternally pass in the LTO pipeline. 2015-08-11 16:26:41 +00:00
ObjCARC Fix some comment typos. 2015-08-08 18:27:36 +00:00
Scalar [IndVarSimplify] Make cost estimation in RewriteLoopExitValues smarter 2015-08-10 18:23:58 +00:00
Utils [LowerSwitch] Fix a bug when LowerSwitch deletes the default block 2015-08-11 18:12:26 +00:00
Vectorize fix minsize detection: minsize attribute implies optimizing for size 2015-08-11 15:56:31 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile