Get rid of the Pass+Context magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp
index 2a7124c..b412147 100644
--- a/lib/Transforms/Utils/LowerSwitch.cpp
+++ b/lib/Transforms/Utils/LowerSwitch.cpp
@@ -162,7 +162,7 @@
Function::iterator FI = OrigBlock;
F->getBasicBlockList().insert(++FI, NewNode);
- ICmpInst* Comp = new ICmpInst(*Default->getContext(), ICmpInst::ICMP_SLT,
+ ICmpInst* Comp = new ICmpInst(Default->getContext(), ICmpInst::ICMP_SLT,
Val, Pivot.Low, "Pivot");
NewNode->getInstList().push_back(Comp);
BranchInst::Create(LBranch, RBranch, Comp, NewNode);
@@ -180,6 +180,7 @@
BasicBlock* Default)
{
Function* F = OrigBlock->getParent();
+ LLVMContext &Context = F->getContext();
BasicBlock* NewLeaf = BasicBlock::Create("LeafBlock");
Function::iterator FI = OrigBlock;
F->getBasicBlockList().insert(++FI, NewLeaf);
@@ -202,11 +203,11 @@
"SwitchLeaf");
} else {
// Emit V-Lo <=u Hi-Lo
- Constant* NegLo = Context->getConstantExprNeg(Leaf.Low);
+ Constant* NegLo = Context.getConstantExprNeg(Leaf.Low);
Instruction* Add = BinaryOperator::CreateAdd(Val, NegLo,
Val->getName()+".off",
NewLeaf);
- Constant *UpperBound = Context->getConstantExprAdd(NegLo, Leaf.High);
+ Constant *UpperBound = Context.getConstantExprAdd(NegLo, Leaf.High);
Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_ULE, Add, UpperBound,
"SwitchLeaf");
}