diff options
author | Chris Lattner <sabre@nondot.org> | 2003-08-23 22:54:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-08-23 22:54:34 +0000 |
commit | f1b1c5ec2ff02587a119afe38e8a3ca0b25cb85d (patch) | |
tree | c5123159a3bc3ac145088ad13bd2a7ef24b247ac /llvm/lib/Transforms/Scalar/LowerSwitch.cpp | |
parent | 1a6242154ed5480cd078866f543903ff00a5078e (diff) | |
download | bcm5719-llvm-f1b1c5ec2ff02587a119afe38e8a3ca0b25cb85d.tar.gz bcm5719-llvm-f1b1c5ec2ff02587a119afe38e8a3ca0b25cb85d.zip |
Fix bug: LowerSwitch/2003-08-23-EmptySwitch.ll
llvm-svn: 8087
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LowerSwitch.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LowerSwitch.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LowerSwitch.cpp b/llvm/lib/Transforms/Scalar/LowerSwitch.cpp index c0e9e0dcd33..73ce2f77f92 100644 --- a/llvm/lib/Transforms/Scalar/LowerSwitch.cpp +++ b/llvm/lib/Transforms/Scalar/LowerSwitch.cpp @@ -63,6 +63,13 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) { // 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) { + CurBlock->getInstList().push_back(new BranchInst(SI->getDefaultDest())); + delete SI; + return; + } + // Expand comparisons for all of the non-default cases... for (unsigned i = 2, e = SI->getNumOperands(); i != e; i += 2) { // Insert a new basic block after the current one... |