mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-03 14:31:10 +00: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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12384 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6cc83750b8
commit
bf9eaddfb0
@ -181,13 +181,10 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) {
|
|||||||
Value *Val = SI->getOperand(0); // The value we are switching on...
|
Value *Val = SI->getOperand(0); // The value we are switching on...
|
||||||
BasicBlock* Default = SI->getDefaultDest();
|
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 there is only the default destination, don't bother with the code below.
|
||||||
if (SI->getNumOperands() == 2) {
|
if (SI->getNumOperands() == 2) {
|
||||||
new BranchInst(SI->getDefaultDest(), CurBlock);
|
new BranchInst(SI->getDefaultDest(), CurBlock);
|
||||||
delete SI;
|
CurBlock->getInstList().erase(SI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,5 +219,5 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) {
|
|||||||
new BranchInst(SwitchBlock, OrigBlock);
|
new BranchInst(SwitchBlock, OrigBlock);
|
||||||
|
|
||||||
// We are now done with the switch instruction, delete it.
|
// We are now done with the switch instruction, delete it.
|
||||||
delete SI;
|
CurBlock->getInstList().erase(SI);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user