about summary refs log tree commit diff homepage
path: root/lib/Module/LowerSwitch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Module/LowerSwitch.cpp')
-rw-r--r--lib/Module/LowerSwitch.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Module/LowerSwitch.cpp b/lib/Module/LowerSwitch.cpp
index 0f4e8b1e..05688521 100644
--- a/lib/Module/LowerSwitch.cpp
+++ b/lib/Module/LowerSwitch.cpp
@@ -64,7 +64,11 @@ void LowerSwitchPass::switchConvert(CaseItr begin, CaseItr end,
   // iterate through all the cases, creating a new BasicBlock for each
   for (CaseItr it = begin; it < end; ++it) {
     BasicBlock *newBlock = BasicBlock::Create(F->getContext(), "NodeBlock");
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
+    Function::iterator FI = origBlock->getIterator();
+#else
     Function::iterator FI = origBlock;
+#endif
     F->getBasicBlockList().insert(++FI, newBlock);
     
     ICmpInst *cmpInst = 
@@ -101,7 +105,11 @@ void LowerSwitchPass::processSwitchInst(SwitchInst *SI) {
   // if-then statements go to this and the PHI nodes are happy.
   BasicBlock* newDefault = BasicBlock::Create(F->getContext(), "newDefault");
 
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
+  F->getBasicBlockList().insert(defaultBlock->getIterator(), newDefault);
+#else
   F->getBasicBlockList().insert(defaultBlock, newDefault);
+#endif
   BranchInst::Create(defaultBlock, newDefault);
 
   // If there is an entry in any PHI nodes for the default edge, make sure