about summary refs log tree commit diff homepage
path: root/lib/Module
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Module')
-rw-r--r--lib/Module/LowerSwitch.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp
index 6667a006..852603b8 100644
--- a/lib/Module/LowerSwitch.cpp
+++ b/lib/Module/LowerSwitch.cpp
@@ -96,7 +96,7 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) {
   BasicBlock *origBlock = SI->getParent();
   BasicBlock *defaultBlock = SI->getDefaultDest();
   Function *F = origBlock->getParent();
-  Value *switchValue = SI->getOperand(0);
+  Value *switchValue = SI->getCondition();
 
   // Create a new, empty default block so that the new hierarchy of
   // if-then statements go to this and the PHI nodes are happy.
@@ -115,9 +115,9 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) {
   }
   
   CaseVector cases;
-  for (unsigned i = 1; i < SI->getNumSuccessors(); ++i)
-    cases.push_back(SwitchCase(SI->getSuccessorValue(i),
-                               SI->getSuccessor(i)));
+  for (unsigned i = 0; i < SI->getNumCases(); ++i)
+    cases.push_back(SwitchCase(SI->getCaseValue(i),
+                               SI->getCaseSuccessor(i)));
   
   // reverse cases, as switchConvert constructs a chain of
   //   basic blocks by appending to the front. if we reverse,