summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LowerSwitch.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-09-29 20:21:17 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-09-29 20:21:17 +0000
commit95031ed8372b030351c48ad0a2f62b7614a12c90 (patch)
tree77e15bf6baecf091994bff0122bdb54632bef2bb /llvm/lib/Transforms/Utils/LowerSwitch.cpp
parent1a526fd96cb393bb5a5bcef3e376bf0a2d61073a (diff)
downloadbcm5719-llvm-95031ed8372b030351c48ad0a2f62b7614a12c90.tar.gz
bcm5719-llvm-95031ed8372b030351c48ad0a2f62b7614a12c90.zip
Clean up uses of switch instructions so they are not dependent on the operand ordering. Patch by Stepan Dyatkovskiy.
llvm-svn: 140803
Diffstat (limited to 'llvm/lib/Transforms/Utils/LowerSwitch.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LowerSwitch.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LowerSwitch.cpp b/llvm/lib/Transforms/Utils/LowerSwitch.cpp
index ed733d393a1..686178ca01c 100644
--- a/llvm/lib/Transforms/Utils/LowerSwitch.cpp
+++ b/llvm/lib/Transforms/Utils/LowerSwitch.cpp
@@ -277,11 +277,11 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) {
BasicBlock *CurBlock = SI->getParent();
BasicBlock *OrigBlock = CurBlock;
Function *F = CurBlock->getParent();
- Value *Val = SI->getOperand(0); // The value we are switching on...
+ Value *Val = SI->getCondition(); // The value we are switching on...
BasicBlock* Default = SI->getDefaultDest();
// If there is only the default destination, don't bother with the code below.
- if (SI->getNumOperands() == 2) {
+ if (SI->getNumCases() == 1) {
BranchInst::Create(SI->getDefaultDest(), CurBlock);
CurBlock->getInstList().erase(SI);
return;
OpenPOWER on IntegriCloud