mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Do not create empty basic blocks when the lowerswitch pass expects blocks to
be non-empty! This fixes LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll llvm-svn: 12384
This commit is contained in:
parent
c143e195ba
commit
7e7c3332b8
@ -181,13 +181,10 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) {
|
||||
Value *Val = SI->getOperand(0); // The value we are switching on...
|
||||
BasicBlock* Default = SI->getDefaultDest();
|
||||
|
||||
// Unlink the switch instruction from it's block.
|
||||
CurBlock->getInstList().remove(SI);
|
||||
|
||||
// If there is only the default destination, don't bother with the code below.
|
||||
if (SI->getNumOperands() == 2) {
|
||||
new BranchInst(SI->getDefaultDest(), CurBlock);
|
||||
delete SI;
|
||||
CurBlock->getInstList().erase(SI);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -222,5 +219,5 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) {
|
||||
new BranchInst(SwitchBlock, OrigBlock);
|
||||
|
||||
// We are now done with the switch instruction, delete it.
|
||||
delete SI;
|
||||
CurBlock->getInstList().erase(SI);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user